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


C# ICodeBuilder类代码示例

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


ICodeBuilder类属于命名空间,在下文中一共展示了ICodeBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateCode

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

            codeBuilder.InsertCode(SnippetInfrastructureKeepSynchronizedMetadata(), ModuleCodeGenerator.CommonInfrastructureMembersTag);
            codeBuilder.InsertCode(SnippetRegisterInfrastructure(), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:KeepSynchronizedRecomputeOnDeployInfrastructureCodeGenerator.cs

示例2: GenerateCode

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

            if (DataStructureCodeGenerator.IsTypeSupported(info.Source))
                codeBuilder.InsertCode(CodeSnippet(info), DataStructureCodeGenerator.FilterTypesTag, info.Source);
        }
开发者ID:Rhetos,项目名称:LegacyRestGenerator,代码行数:7,代码来源:FilterByCodeGenerator.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: 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

示例5: GenerateCode

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

            codeBuilder.InsertCode(FilterSaveFunction(info), RepositoryHelper.RepositoryMembers, info.EntityComputedFrom.Target);
            codeBuilder.InsertCode(SnippetDefaultFilterSaveOnRecompute(info), EntityComputedFromCodeGenerator.OverrideDefaultFiltersTag, info.EntityComputedFrom);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:KeepSynchronizedCodeGenerator.cs

示例6: GenerateCode

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

            if(info.Reference.Referenced is IWritableOrmDataStructure)
                codeBuilder.InsertCode(CodeSnippetDeleteChildren(info), WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Reference.Referenced);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:ReferenceCascadeDeleteCodeGenerator.cs

示例7: ExtendDatabaseStructure

        public void ExtendDatabaseStructure(IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out IEnumerable<Tuple<IConceptInfo, IConceptInfo>> createdDependencies)
        {
            var info = (PolymorphicPropertyInfo)conceptInfo;

            var propertyColumnNames = _conceptMetadata.Get(info.Property, PropertyDatabaseDefinition.ColumnNamesMetadata);
            var propertyColumnTypes = _conceptMetadata.Get(info.Property, PropertyDatabaseDefinition.ColumnTypesMetadata);

            foreach (var column in propertyColumnNames.Zip(propertyColumnTypes, (name, type) => new { name, type }))
            {
                string columnImplementationsSelector = info.IsImplementable()
                    ? ", " + column.name
                    : ", " + column.name + " = NULL";

                codeBuilder.InsertCode(
                    columnImplementationsSelector,
                    PolymorphicUnionViewInfo.PolymorphicPropertyNameTag,
                    info.Dependency_PolymorphicUnionView);

                string columnInitialization = string.Format(",\r\n    {0} = CONVERT({1}, NULL)", column.name, column.type);

                codeBuilder.InsertCode(
                    columnInitialization,
                    PolymorphicUnionViewInfo.PolymorphicPropertyInitializationTag,
                    info.Dependency_PolymorphicUnionView);
            }

            createdDependencies = null;
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:28,代码来源:PolymorphicPropertyDatabaseDefinition.cs

示例8: 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

示例9: 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

示例10: GenerateCode

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

            var interfaceType = Type.GetType(info.InterfaceAssemblyQualifiedName);
            if (interfaceType == null)
                throw new DslSyntaxException(conceptInfo, "Could not find type '" + info.InterfaceAssemblyQualifiedName + "'.");

            // TODO: Remove IQueryableRepository registration.  IQueryableRepository should be cast from repository object in Rhetos.Dom.DefaultConcepts.GenericRepositories class.
            string registerRepository = string.Format(
                @"builder.RegisterType<{0}._Helper.{1}_Repository>().As<IQueryableRepository<{2}>>().InstancePerLifetimeScope();
            ",
                    info.DataStructure.Module.Name,
                    info.DataStructure.Name,
                    interfaceType.FullName);

            codeBuilder.InsertCode(registerRepository, ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);

            string registerImplementationName = string.Format(
                @"{{ typeof({0}), {1} }},
            ",
                    interfaceType.FullName,
                    CsUtility.QuotedString(
                        info.DataStructure.Module.Name
                        + "." + info.DataStructure.Name));

            codeBuilder.InsertCode(registerImplementationName, ModuleCodeGenerator.RegisteredInterfaceImplementationNameTag);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:28,代码来源:RegisteredInterfaceImplementationCodeGenerator.cs

示例11: GenerateCode

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

            codeBuilder.InsertCode(GenerateCommonClassesSnippet());
            if (_configuration.GetBool("EntityFramework.UseDatabaseNullSemantics", false).Value == true)
                codeBuilder.InsertCode("this.Configuration.UseDatabaseNullSemantics = true;\r\n            ", EntityFrameworkContextInitializeTag);

            // Types used in the preceding code snippet:
            codeBuilder.AddReferencesFromDependency(typeof(Autofac.Module)); // Includes a reference to Autofac.dll.
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Extensibility.INamedPlugins<>));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Utilities.IUserInfo));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Utilities.ISqlExecuter));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Security.IAuthorizationManager));
            codeBuilder.AddReferencesFromDependency(typeof(System.ComponentModel.Composition.ExportAttribute));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.GenericRepositories));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Logging.ILogProvider));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Security.IWindowsSecurity));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.DbContext));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.SqlServer.SqlProviderServices));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.Core.EntityClient.EntityConnection));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.Infrastructure.IObjectContextAdapter));
            codeBuilder.AddReferencesFromDependency(typeof(System.Data.Entity.Core.Objects.ObjectStateEntry));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Persistence.IPersistenceCache));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Persistence.IPersistenceTransaction));
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:27,代码来源:DomInitializationCodeGenerator.cs

示例12: ExtendDatabaseStructure

        public void ExtendDatabaseStructure(IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out IEnumerable<Tuple<IConceptInfo, IConceptInfo>> createdDependencies)
        {
            var info = (SubtypeExtendPolymorphicInfo)conceptInfo;

            codeBuilder.InsertCode(UnionSubquerySnippet(info), PolymorphicUnionViewInfo.SubtypeQueryTag, info.PolymorphicUnionView);
            createdDependencies = new[] { Tuple.Create<IConceptInfo, IConceptInfo>(info.SubtypeImplementationView, info.PolymorphicUnionView) };
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:7,代码来源:SubtypeExtendPolymorphicDatabaseDefinition.cs

示例13: GenerateCode

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

            codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
            codeBuilder.InsertCode(RegisterImplementationName(info), ModuleCodeGenerator.RegisteredInterfaceImplementationNameTag);
        }
开发者ID:kmeze,项目名称:Rhetos,代码行数:7,代码来源:RegisteredInterfaceImplementationCodeGenerator.cs

示例14: ExtendDatabaseStructure

        public void ExtendDatabaseStructure(IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out IEnumerable<Tuple<IConceptInfo, IConceptInfo>> createdDependencies)
        {
            var info = (SqlUniqueMultipleInfo)conceptInfo;
            createdDependencies = null;

            codeBuilder.InsertCode(Sql.Get("SqlUniqueMultipleDatabaseDefinition_ExtendOption1"), SqlIndexMultipleDatabaseDefinition.Options1Tag, info.SqlIndex);
        }
开发者ID:koav,项目名称:Rhetos,代码行数:7,代码来源:SqlUniqueMultipleDatabaseDefinition.cs

示例15: GenerateQueryableRepositoryFunctions

 public static void GenerateQueryableRepositoryFunctions(DataStructureInfo info, ICodeBuilder codeBuilder, string queryFunctionBody)
 {
     GenerateReadableRepositoryFunctions(info, codeBuilder, "return Query().ToArray();\r\n            ");
     codeBuilder.InsertCode(RepositoryQueryFunctionsSnippet(info, queryFunctionBody), RepositoryMembers, info);
     codeBuilder.InsertCode("IQueryableRepository<" + info.Module.Name + "." + info.Name + ">", RepositoryInterfaces, info);
     codeBuilder.InsertCode("IFilterRepository<IEnumerable<Guid>, " + info.Module.Name + "." + info.Name + ">", RepositoryInterfaces, info);
 }
开发者ID:kmeze,项目名称:Rhetos,代码行数:7,代码来源:RepositoryHelper.cs


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