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


C# ICodeBuilder.AddReferencesFromDependency方法代码示例

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


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

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

示例2: GenerateCode

        public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
        {
            codeBuilder.InsertCode(CodeSnippet);

            codeBuilder.AddReference(CaptionsResourceGenerator.ResourcesAssemblyDllPath);
            codeBuilder.AddReferencesFromDependency(typeof(Guid));
            codeBuilder.AddReferencesFromDependency(typeof(System.Linq.Enumerable));
            codeBuilder.AddReferencesFromDependency(typeof(System.ComponentModel.DefaultValueAttribute)); // using namespace System.ComponentModel
            codeBuilder.AddReferencesFromDependency(typeof(System.ComponentModel.DataAnnotations.DisplayAttribute)); // using namespace System.ComponentModel.DataAnnotations
        }
开发者ID:Rhetos,项目名称:MvcModelGenerator,代码行数:10,代码来源:MvcModelInitialCodeGenerator.cs

示例3: GenerateCode

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

            codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
            codeBuilder.InsertCode("IReportRepository", RepositoryHelper.RepositoryInterfaces, info);
            codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);

            codeBuilder.AddReferencesFromDependency(typeof(ReportFile));
            codeBuilder.AddReferencesFromDependency(typeof(IReportRepository));
        }
开发者ID:koav,项目名称:Rhetos,代码行数:11,代码来源:ReportFileCodeGenerator.cs

示例4: GenerateCode

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

            codeBuilder.InsertCode(ServiceRegistrationCodeSnippet(info), InitialCodeGenerator.ServiceRegistrationTag);
            codeBuilder.InsertCode(ServiceInitializationCodeSnippet(info), InitialCodeGenerator.ServiceInitializationTag);
            codeBuilder.InsertCode(ServiceDefinitionCodeSnippet(info), InitialCodeGenerator.RhetosRestClassesTag);

            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.RestGenerator.Utilities.ServiceUtility));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.RestGenerator.Utilities.DownloadReportResult));
            codeBuilder.AddReferencesFromDependency(typeof(Newtonsoft.Json.JsonConvert));
        }
开发者ID:bantolov,项目名称:RestGenerator,代码行数:12,代码来源:ReportCodeGenerator.cs

示例5: GenerateCode

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

            if (info.Module.Name == "Common" && info.Name == "PermissionBrowse")
            {
                codeBuilder.InsertCode("Rhetos.Dom.DefaultConcepts.IPermissionLoader", RepositoryHelper.RepositoryInterfaces, info);
                codeBuilder.InsertCode(MemberFunctionsSnippet, RepositoryHelper.RepositoryMembers, info);
                codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
                codeBuilder.AddReferencesFromDependency(typeof(IPermissionLoader));
                codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Security.Claim));
            }
        }
开发者ID:koav,项目名称:Rhetos,代码行数:13,代码来源:PermissionLoaderCodeGenerator.cs

示例6: GenerateCode

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

            RepositoryHelper.GenerateRepository(info, codeBuilder);
            codeBuilder.InsertCode("IActionRepository", RepositoryHelper.RepositoryInterfaces, info);
            codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
            codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);

            codeBuilder.AddReferencesFromDependency(typeof(ExportAttribute));
            codeBuilder.AddReferencesFromDependency(typeof(ExportMetadataAttribute));
            codeBuilder.AddReferencesFromDependency(typeof(MefProvider));
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:13,代码来源:ActionCodeGenerator.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)
        {
            DataStructureInfo info = (DataStructureInfo)conceptInfo;

            if (IsTypeSupported(info))
            {
                codeBuilder.InsertCode(ServiceRegistrationCodeSnippet(info), InitialCodeGenerator.ServiceRegistrationTag);
                codeBuilder.InsertCode(ServiceInitializationCodeSnippet(info), InitialCodeGenerator.ServiceInitializationTag);
                codeBuilder.InsertCode(ServiceDefinitionCodeSnippet(info), InitialCodeGenerator.RhetosRestClassesTag);
                codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Processing.DefaultCommands.ReadCommandResult));
                codeBuilder.AddReferencesFromDependency(typeof(Newtonsoft.Json.Linq.JToken));

                if (info is IWritableOrmDataStructure)
                    WritableOrmDataStructureCodeGenerator.GenerateCode(conceptInfo, codeBuilder);
            }
        }
开发者ID:bantolov,项目名称:RestGenerator,代码行数:16,代码来源:DataStructureCodeGenerator.cs

示例9: GenerateCode

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

            codeBuilder.InsertCode(DefaultSnippet(info), WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Entity);
            codeBuilder.InsertCode("Rhetos.Dom.DefaultConcepts.IDeactivatable", DataStructureCodeGenerator.InterfaceTag, info.Entity);
            codeBuilder.AddReferencesFromDependency(typeof(IDeactivatable));
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:8,代码来源:DeactivatableCodeGenerator.cs

示例10: GenerateCode

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

            codeBuilder.InsertCode(ImplementationCodeSnippet(info));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Mvc.BaseMvcModel));

            _localizedDisplayAttribute.InsertOrOverrideAttribute(codeBuilder, info, LocalizedDisplayAttributeProperties(info));
        }
开发者ID:Rhetos,项目名称:MvcModelGenerator,代码行数:9,代码来源:DataStructureCodeGenerator.cs

示例11: GenerateCode

 public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
 {
     var info = (UserRequiredPropertyInfo)conceptInfo;
     if (IsSupported(info.Property))
     {
         codeBuilder.InsertCode(CheckDataSnippet(info), WritableOrmDataStructureCodeGenerator.ArgumentValidationTag, info.Property.DataStructure);
         codeBuilder.AddReferencesFromDependency(typeof(UserException));
     }
 }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:9,代码来源:UserRequiredPropertyCodeGenerator.cs

示例12: GenerateCode

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

            if (info.Module.Name == "Common" && info.Name == "Claim")
                codeBuilder.InsertCode(RepositoryMemberSnippet(info), RepositoryHelper.RepositoryMembers, info);

            codeBuilder.AddReferencesFromDependency(typeof(DeactivateInsteadOfDelete));
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:9,代码来源:ClaimRepositoryCodeGenerator.cs

示例13: GenerateCode

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

            string snippet = string.Format(
                @"Rhetos.Dom.DefaultConcepts.AutoCodeHelper.UpdateCodes(
                _executionContext.NHibernateSession, ""{0}.{1}"", ""{2}"",
                insertedNew.Select(item => new Rhetos.Dom.DefaultConcepts.AutoCodeItem<{0}.{1}> {{ Item = item, Code = item.{2}, Grouping = """" }}),
                (item, newCode) => item.{2} = newCode);

            ",
                info.Property.DataStructure.Module.Name,
                info.Property.DataStructure.Name,
                info.Property.Name);
            codeBuilder.InsertCode(snippet, WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Property.DataStructure);
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.AutoCodeHelper));
            codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.AutoCodeItem<>));
        }
开发者ID:kmeze,项目名称:Rhetos,代码行数:18,代码来源:AutoCodeCachedCodeGenerator.cs

示例14: GenerateCode

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

            if (IsSupported(info))
            {
                codeBuilder.InsertCode(CheckSavedItemsSnippet(info), WritableOrmDataStructureCodeGenerator.OnSaveTag2, info.DataStructure);
                codeBuilder.AddReferencesFromDependency(typeof(UserException));
            }
        }
开发者ID:koav,项目名称:Rhetos,代码行数:10,代码来源:UniqueMultiplePropertiesCodeGenerator.cs

示例15: GenerateCode

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

            var type = Type.GetType(info.TypeOrAssembly);
            if (type != null)
                codeBuilder.AddReferencesFromDependency(type);
            else
                codeBuilder.AddReference(info.TypeOrAssembly);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:10,代码来源:ModuleExternalReferenceCodeGenerator.cs


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