• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IConceptInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IConceptInfo的典型用法代码示例。如果您正苦于以下问题:C# IConceptInfo类的具体用法?C# IConceptInfo怎么用?C# IConceptInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IConceptInfo类属于命名空间,在下文中一共展示了IConceptInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: GenerateDependencies

        public static IEnumerable<IConceptInfo> GenerateDependencies(IConceptInfo dependent, IDslModel existingConcepts, string sqlScript)
        {
            SortedSet<string> sqlObjectsInScript;
            if (!SqlObjectsCache.TryGetValue(sqlScript, out sqlObjectsInScript))
            {
                sqlObjectsInScript = new SortedSet<string>(ExtractPossibleObjects(sqlScript), StringComparer.InvariantCultureIgnoreCase);
                SqlObjectsCache.Add(sqlScript, sqlObjectsInScript);
            }

            var newConcepts = new List<IConceptInfo>();

            var conceptsBySqlName = existingConcepts.GetIndex<SqlObjectsIndex>().ConceptsBySqlName;

            foreach (var sqlObjectInScript in sqlObjectsInScript)
                foreach (var conceptInfo in conceptsBySqlName.Get(sqlObjectInScript))
                    if (conceptInfo != dependent)
                    {
                        if (conceptInfo is DataStructureInfo)
                            newConcepts.Add(new SqlDependsOnDataStructureInfo { Dependent = dependent, DependsOn = (DataStructureInfo)conceptInfo });
                        else if (conceptInfo is SqlViewInfo)
                            newConcepts.Add(new SqlDependsOnSqlViewInfo { Dependent = dependent, DependsOn = (SqlViewInfo)conceptInfo });
                        else if (conceptInfo is SqlFunctionInfo)
                            newConcepts.Add(new SqlDependsOnSqlFunctionInfo { Dependent = dependent, DependsOn = (SqlFunctionInfo)conceptInfo });
                        else
                            throw new DslSyntaxException(dependent, "Internal error: Unexpected SQL concept type: " + conceptInfo.GetUserDescription() + ".");
                    }

            return newConcepts;
        }
开发者ID:kmeze,项目名称:Rhetos,代码行数:29,代码来源:SqlAnalysis.cs


示例17: GenerateDependencies

        public static IEnumerable<IConceptInfo> GenerateDependencies(IConceptInfo dependent, IEnumerable<IConceptInfo> existingConcepts, string sqlScript)
        {
            HashSet<string> sqlObjects;
            if (!SqlObjectsCache.TryGetValue(sqlScript, out sqlObjects))
            {
                sqlObjects = new HashSet<string>(ExtractPossibleObjects(sqlScript));
                SqlObjectsCache.Add(sqlScript, sqlObjects);
            }

            var newConcepts = new List<IConceptInfo>();
            foreach (var conceptInfo in existingConcepts)
                if (conceptInfo != dependent)
                {
                    var conceptType = conceptInfo.GetType();
                    if (typeof(DataStructureInfo).IsAssignableFrom(conceptType))
                    {
                        if (sqlObjects.Contains(conceptInfo.GetKeyProperties())) // Currently, GetKeyProperties is not cached, so checking Contains after IsAssignableFrom improves execution speed.
                            newConcepts.Add(new SqlDependsOnDataStructureInfo { Dependent = dependent, DependsOn = (DataStructureInfo)conceptInfo });
                    }
                    else if (typeof(SqlViewInfo).IsAssignableFrom(conceptType))
                    {
                        if (sqlObjects.Contains(conceptInfo.GetKeyProperties()))
                            newConcepts.Add(new SqlDependsOnSqlViewInfo { Dependent = dependent, DependsOn = (SqlViewInfo)conceptInfo });
                    }
                    else if (typeof(SqlFunctionInfo).IsAssignableFrom(conceptType))
                    {
                        if (sqlObjects.Contains(conceptInfo.GetKeyProperties()))
                            newConcepts.Add(new SqlDependsOnSqlFunctionInfo { Dependent = dependent, DependsOn = (SqlFunctionInfo)conceptInfo });
                    }
                }
            return newConcepts;
        }
开发者ID:koav,项目名称:Rhetos,代码行数:32,代码来源:SqlAnalysis.cs


示例18: CreateDatabaseStructure

 public string CreateDatabaseStructure(IConceptInfo conceptInfo)
 {
     var info = (DateTimePropertyInfo)conceptInfo;
     if (info.DataStructure is EntityInfo)
         return PropertyDatabaseDefinition.AddColumn(info, SqlUtility.Identifier(info.Name), Sql.Get("DateTimePropertyDatabaseDefinition_DataType"));
     return "";
 }
开发者ID:koav,项目名称:Rhetos,代码行数:7,代码来源:DateTimePropertyDatabaseDefinition.cs


示例19: InitializeNonparsableProperties

 public void InitializeNonparsableProperties(out IEnumerable<IConceptInfo> createdConcepts)
 {
     if (!(Property.DataStructure is EntityInfo))
         throw new DslSyntaxException(this, "AutoCode concept may only be used on properties of entity.");
     Dependency_TriggerInfo = new AutoCodeTriggerInfo { Entity = (EntityInfo)this.Property.DataStructure };
     createdConcepts = new IConceptInfo[] { Dependency_TriggerInfo };
 }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:AutoCodePropertyInfo.cs


示例20: GenerateCode

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

            string extendSystemMessage = @"+"",Property:" + info.MarkProperty.Name + @"""";
            codeBuilder.InsertCode(extendSystemMessage, InvalidDataCodeGenerator.SystemMessageAppendTag, info.InvalidData);
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:7,代码来源:InvalidDataMarkProperty2CodeGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICondition类代码示例发布时间:2022-05-24
下一篇:
C# ICompressor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap