当前位置: 首页>>代码示例>>C#>>正文


C# IConceptInfo类代码示例

本文整理汇总了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);
            }
        }
开发者ID:GADMarko,项目名称:MvcModelGenerator,代码行数:26,代码来源:ReferencePropertyCodeGenerator.cs

示例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, @"""+""");
        }
开发者ID:Rhetos,项目名称:MvcModelGenerator,代码行数:7,代码来源:AutoCodePropertyCodeGenerator.cs

示例3: GenerateCode

        public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
        {
            var info = (ReportDataInfo)conceptInfo;

            RepositoryHelper.GenerateRepository(info, codeBuilder);
            codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:7,代码来源:ReportDataCodeGenerator.cs

示例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));
 }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:SqlQueryableDatabaseDefinition.cs

示例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));
            }
        }
开发者ID:koav,项目名称:Rhetos,代码行数:28,代码来源:ReferencePropertyCodeGenerator.cs

示例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;
        }
开发者ID:koav,项目名称:Rhetos,代码行数:32,代码来源:SqlAnalysis.cs

示例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));
 }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:7,代码来源:DenyUserEditCodeGenerator.cs

示例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);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:ComputationUseExecutionContextCodeGenerator.cs

示例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));
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:35,代码来源:InvalidDataCodeGenerator.cs

示例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");
        }
开发者ID:Rhetos,项目名称:MvcModelGenerator,代码行数:7,代码来源:ActiveBoolDefaultCodeGenerator.cs

示例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);
            }
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:29,代码来源:OrmDataStructureCodeGenerator.cs

示例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);
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:7,代码来源:FilterIdRepositoryCodeGenerator.cs

示例13: GenerateCode

        public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
        {
            var info = (DateTimePropertyInfo)conceptInfo;

            if (SimplePropertyMappingGenerator.IsSupported(info))
                codeBuilder.InsertCode(@"type=""timestamp"" ", SimplePropertyMappingGenerator.AttributesTag, info);
        }
开发者ID:kmeze,项目名称:Rhetos,代码行数:7,代码来源:DateTimePropertyMappingGenerator.cs

示例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;
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:27,代码来源:SqlNotNullDatabaseDefinition.cs

示例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);
 }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:PropertyComputedFromCodeGenerator.cs


注:本文中的IConceptInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。