本文整理汇总了C#中IConceptInfo类的典型用法代码示例。如果您正苦于以下问题:C# IConceptInfo类的具体用法?C# IConceptInfo怎么用?C# IConceptInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConceptInfo类属于命名空间,在下文中一共展示了IConceptInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
ReferencePropertyInfo info = (ReferencePropertyInfo)conceptInfo;
if (DataStructureCodeGenerator.IsTypeSupported(info.DataStructure))
{
var properties = GetReferenceProperties(_dslModel.Concepts, info);
string lookupField = "";
var lookupColumns = new List<string>();
foreach (var prop in properties)
{
lookupField = prop.Name;
lookupColumns.Add("\"" + prop.Name + "\"");
}
string lookupEntity = info.Referenced.Name;
//string dodatniAtribut = string.Format(ReferenceFormat, _dslModel.Concepts.Count(), lookupEntity, String.Join(", ", lookupColumns));
string dodatniAtribut = string.Format(ReferenceFormat, lookupField, lookupEntity, String.Join(", " , lookupColumns));
MvcPropertyHelper.GenerateCodeForType(_dslModel, info, codeBuilder, "Guid?", "ID", dodatniAtribut);
}
}
示例2: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (AutoCodePropertyInfo)conceptInfo;
if (info.Property is ShortStringPropertyInfo || info.Property is LongStringPropertyInfo)
_defaultAttribute.InsertOrOverrideAttribute(codeBuilder, info.Property, @"""+""");
}
示例3: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ReportDataInfo)conceptInfo;
RepositoryHelper.GenerateRepository(info, codeBuilder);
codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
}
示例4: RemoveDatabaseStructure
public string RemoveDatabaseStructure(IConceptInfo conceptInfo)
{
var info = (SqlQueryableInfo)conceptInfo;
return Sql.Format("SqlQueryableDatabaseDefinition_Remove",
SqlUtility.Identifier(info.Module.Name),
SqlUtility.Identifier(info.Name));
}
示例5: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
ReferencePropertyInfo info = (ReferencePropertyInfo)conceptInfo;
PropertyHelper.GenerateCodeForType(info, codeBuilder, info.Referenced.Module.Name + "." + info.Referenced.Name, false);
var referenceGuid = new PropertyInfo { DataStructure = info.DataStructure, Name = info.Name + "ID" };
codeBuilder.InsertCode(ReferenceIDSnippet(info, referenceGuid), DataStructureCodeGenerator.BodyTag, info.DataStructure);
codeBuilder.InsertCode("[DataMember]", PropertyHelper.AttributeTag, referenceGuid);
if (info.DataStructure is IWritableOrmDataStructure)
{
codeBuilder.InsertCode(
string.Format(CultureInfo.InvariantCulture,
@" foreach(var item in insertedNew)
if(item.{0}ID != null)
item.{0} = _executionContext.NHibernateSession.Load<{1}.{2}>(item.{0}ID);
foreach(var item in updatedNew)
if(item.{0}ID != null)
item.{0} = _executionContext.NHibernateSession.Load<{1}.{2}>(item.{0}ID);
foreach(var item in deletedIds)
if(item.{0}ID != null)
item.{0} = _executionContext.NHibernateSession.Load<{1}.{2}>(item.{0}ID);
",
info.Name, info.Referenced.Module.Name, info.Referenced.Name),
WritableOrmDataStructureCodeGenerator.InitializationTag.Evaluate(info.DataStructure));
}
}
示例6: GenerateDependenciesToObject
public static IEnumerable<IConceptInfo> GenerateDependenciesToObject(IConceptInfo dependent, IEnumerable<IConceptInfo> existingConcepts, string sqlObjectName)
{
var newConcepts = new List<IConceptInfo>();
sqlObjectName = sqlObjectName.Trim();
bool function = sqlObjectName.Contains('(');
if (function)
sqlObjectName = sqlObjectName.Substring(0, sqlObjectName.IndexOf('('));
var nameParts = sqlObjectName.Split('.');
if (nameParts.Length != 2)
return newConcepts;
if (function)
{
newConcepts.AddRange(existingConcepts.OfType<SqlFunctionInfo>()
.Where(ci => ci.Module.Name == nameParts[0] && ci.Name == nameParts[1] && ci != dependent)
.Select(ci => new SqlDependsOnSqlFunctionInfo { Dependent = dependent, DependsOn = ci }));
}
else
{
newConcepts.AddRange(existingConcepts.OfType<DataStructureInfo>()
.Where(ci => ci.Module.Name == nameParts[0] && ci.Name == nameParts[1] && ci != dependent)
.Select(ci => new SqlDependsOnDataStructureInfo { Dependent = dependent, DependsOn = ci }));
newConcepts.AddRange(existingConcepts.OfType<SqlViewInfo>()
.Where(ci => ci.Module.Name == nameParts[0] && ci.Name == nameParts[1] && ci != dependent)
.Select(ci => new SqlDependsOnSqlViewInfo { Dependent = dependent, DependsOn = ci }));
}
return newConcepts;
}
示例7: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DenyUserEditInfo)conceptInfo;
codeBuilder.InsertCode(CheckChangesOnInsertSnippet(info), WritableOrmDataStructureCodeGenerator.ArgumentValidationTag, info.Property.DataStructure);
codeBuilder.InsertCode(CheckChangesOnUpdateSnippet(info), WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Property.DataStructure);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
示例8: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ComputationUseExecutionContextInfo)conceptInfo;
codeBuilder.InsertCode(", Common.ExecutionContext", DataStructureUtility.ComputationAdditionalParametersTypeTag, info.Computation);
codeBuilder.InsertCode(", _executionContext", DataStructureUtility.ComputationAdditionalParametersArgumentTag, info.Computation);
}
示例9: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (InvalidDataInfo)conceptInfo;
// Using nonstandard naming of variables to avoid name clashes with injected code.
string getErrorMessageMethod =
@"public IEnumerable<InvalidDataMessage> " + info.GetErrorMessageMethodName() + @"(IEnumerable<Guid> invalidData_Ids)
{
const string invalidData_Description = " + CsUtility.QuotedString(info.ErrorMessage) + @";
" + OverrideUserMessagesTag.Evaluate(info) + @" return invalidData_Ids.Select(id => new InvalidDataMessage { ID = id, Message = invalidData_Description });
}
";
codeBuilder.InsertCode(getErrorMessageMethod, RepositoryHelper.RepositoryMembers, info.Source);
codeBuilder.AddReferencesFromDependency(typeof(InvalidDataMessage));
string dataStructure = info.Source.Module.Name + "." + info.Source.Name;
string systemMessage = @"""DataStructure:" + dataStructure + @",ID:"" + invalidItemId.ToString()" + SystemMessageAppendTag.Evaluate(info);
string validationSnippet =
@"if (insertedNew.Count() > 0 || updatedNew.Count() > 0)
{
Guid[] changedItemsId = inserted.Concat(updated).Select(item => item.ID).ToArray();
Guid invalidItemId = this.Filter(this.Query(changedItemsId), new " + info.FilterType + @"())
.Select(item => item.ID).FirstOrDefault();
if (invalidItemId != default(Guid))
{
var userMessage = " + info.GetErrorMessageMethodName() + @"(new[] { invalidItemId }).Single();
string systemMessage = " + systemMessage + @";
throw new Rhetos.UserException(userMessage.Message, userMessage.MessageParameters, systemMessage, null);
}
}
";
codeBuilder.InsertCode(validationSnippet, WritableOrmDataStructureCodeGenerator.OnSaveTag2, info.Source);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
示例10: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (PropertyInfo)conceptInfo;
if (info.Name.Equals("Active", StringComparison.InvariantCultureIgnoreCase))
_defaultAttribute.InsertOrOverrideAttribute(codeBuilder, info, @"true");
}
示例11: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DataStructureInfo)conceptInfo;
var orm = info as IOrmDataStructure;
if (orm != null)
{
codeBuilder.InsertCode(SnippetEntityClassMembers(info), DataStructureCodeGenerator.BodyTag, info);
DataStructureCodeGenerator.AddInterfaceAndReference(codeBuilder, string.Format("System.IEquatable<{0}>", info.Name), typeof(System.IEquatable<>), info);
RepositoryHelper.GenerateRepository(info, codeBuilder);
RepositoryHelper.GenerateQueryableRepositoryFunctions(info, codeBuilder, QuerySnippet(info));
codeBuilder.InsertCode(SnippetQueryableFilterById(info), RepositoryHelper.RepositoryMembers, info);
PropertyInfo idProperty = new PropertyInfo { DataStructure = info, Name = "ID" };
PropertyHelper.GenerateCodeForType(idProperty, codeBuilder, "Guid");
DataStructureCodeGenerator.AddInterfaceAndReference(codeBuilder, typeof(IEntity), info);
codeBuilder.InsertCode(
string.Format("public System.Data.Entity.DbSet<Common.Queryable.{0}_{1}> {0}_{1} {{ get; set; }}\r\n ",
info.Module.Name, info.Name),
DomInitializationCodeGenerator.EntityFrameworkContextMembersTag);
codeBuilder.InsertCode(
string.Format("modelBuilder.Ignore<global::{0}.{1}>();\r\n "
+ "modelBuilder.Entity<Common.Queryable.{0}_{1}>().Map(m => {{ m.MapInheritedProperties(); m.ToTable(\"{3}\", \"{2}\"); }});\r\n ",
info.Module.Name, info.Name, orm.GetOrmSchema(), orm.GetOrmDatabaseObject()),
DomInitializationCodeGenerator.EntityFrameworkOnModelCreatingTag);
}
}
示例12: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DataStructureInfo)conceptInfo;
if (info.Module.Name == "Common" && info.Name == "FilterId")
codeBuilder.InsertCode(snippet, RepositoryHelper.RepositoryMembers, info);
}
示例13: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DateTimePropertyInfo)conceptInfo;
if (SimplePropertyMappingGenerator.IsSupported(info))
codeBuilder.InsertCode(@"type=""timestamp"" ", SimplePropertyMappingGenerator.AttributesTag, info);
}
示例14: ExtendDatabaseStructure
public void ExtendDatabaseStructure(IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out System.Collections.Generic.IEnumerable<Tuple<IConceptInfo, IConceptInfo>> createdDependencies)
{
var info = (SqlNotNullInfo)conceptInfo;
var sql = new StringBuilder();
if (_conceptMetadata.Contains(info.Property, PropertyDatabaseDefinition.ColumnTypesMetadata))
{
var columnNames = _conceptMetadata.Get(info.Property, PropertyDatabaseDefinition.ColumnNamesMetadata);
var columnTypes = _conceptMetadata.Get(info.Property, PropertyDatabaseDefinition.ColumnTypesMetadata);
var columns = columnNames.Zip(columnTypes, (name, type) => new { name, type });
foreach (var column in columns)
sql.AppendLine(Sql.Format("SqlNotNull_Create",
SqlUtility.Identifier(info.Property.DataStructure.Module.Name),
SqlUtility.Identifier(info.Property.DataStructure.Name),
column.name,
column.type,
info.InitialValueSqlExpression,
SqlUtility.ScriptSplitterTag).Trim());
}
var sqlSnippet = sql.ToString().Trim() + "\r\n";
if (!string.IsNullOrWhiteSpace(sqlSnippet))
codeBuilder.InsertCode(sqlSnippet, PropertyDatabaseDefinition.AfterCreateTag, info.Property);
createdDependencies = null;
}
示例15: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (PropertyComputedFromInfo)conceptInfo;
codeBuilder.InsertCode(CompareValuePropertySnippet(info), EntityComputedFromCodeGenerator.CompareValuePropertyTag, info.Dependency_EntityComputedFrom);
codeBuilder.InsertCode(ClonePropertySnippet(info), EntityComputedFromCodeGenerator.ClonePropertyTag, info.Dependency_EntityComputedFrom);
codeBuilder.InsertCode(AssignPropertySnippet(info), EntityComputedFromCodeGenerator.AssignPropertyTag, info.Dependency_EntityComputedFrom);
}