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

C# CodeGenerationContext类代码示例

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

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



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

示例1: CSharpGatewayExpressionBinder

        private CSharpGatewayExpressionBinder(CodeGenerationContext codeGenerationContext)
        {
            this.CodeGenerationContext = codeGenerationContext;

            this.httpClientType = FickleType.Define(this.CodeGenerationContext.Options.ServiceClientTypeName ?? "HttpClient");
            this.httpStreamSerializerType = FickleType.Define("IHttpStreamSerializer");
        }
开发者ID:samcook,项目名称:Fickle,代码行数:7,代码来源:CSharpGatewayExpressionBinder.cs


示例2: ElementGenerator

 /// <summary>
 /// Constructor for the custom code generator
 /// </summary>
 /// <param name="context">Context of the current code generation operation based on how scaffolder was invoked(such as selected project/folder) </param>
 /// <param name="information">Code generation information that is defined in the factory class.</param>
 public ElementGenerator(
     CodeGenerationContext context,
     CodeGeneratorInformation information)
     : base(context, information)
 {
     _viewModel = new ElementViewModel();
 }
开发者ID:OsvaldoJ,项目名称:orchardizer,代码行数:12,代码来源:ElementGenerator.cs


示例3: CustomCodeGenerator

 /// <summary>
 /// Constructor for the custom code generator
 /// </summary>
 /// <param name="context">Context of the current code generation operation based on how scaffolder was invoked(such as selected project/folder) </param>
 /// <param name="information">Code generation information that is defined in the factory class.</param>
 public CustomCodeGenerator(
     CodeGenerationContext context,
     CodeGeneratorInformation information)
     : base(context, information)
 {
     _viewModel = new CustomViewModel(Context);
 }
开发者ID:genoher,项目名称:DriveTimeScaffolding,代码行数:12,代码来源:CustomCodeGenerator.cs


示例4: PropertiesToCopyExpressionBinder

 protected PropertiesToCopyExpressionBinder(CodeGenerationContext codeGenerationContext, Type type, Expression zone, Expression theCopy)
 {
     this.codeGenerationContext = codeGenerationContext;
     this.type = type;
     this.zone = zone;
     this.theCopy = theCopy;
 }
开发者ID:samcook,项目名称:Fickle,代码行数:7,代码来源:PropertiesToCopyExpressionBinder.cs


示例5: CustomViewModel

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The code generation context</param>
        public CustomViewModel(CodeGenerationContext context)
        {
            this.Context = context;

            // we typically name our custom binding handlers like this
            this.CustomBindingHandlerName = "yourBindingHandler";

            // not sure on this one, we'll set it as a global dependency by default, if for nothing other than convenience 
            this.IncludeAsGlobalDependency = true;

            // normally we dont generate unit tests for a custom binding handler, only if we're being thorough
            this.GenerateUnitTests = false;

            // we normally don't have less files for a custom binding handler, so set this to off as default
            this.GenerateLessFile = false;

            // if we do want a less file, we'll probably want that imported
            this.ImportLessFile = true;

            this.CreateInitCallback = true;

            this.CreateUpdateCallback = false;


            this.MasterLessFilePath = @"src\css\all-components.less";

            this.UnitTestModuleLocation = @"src\test\all-tests.ts";

            this.RootPathForBindingHandler = @"src\bindingHandlers\";

            this.UnitTestCreationLocation = @"src\test\bindingHandlers\";

            this.PathForAmdDependency = @"src/app/startup.ts";
            
        }
开发者ID:genoher,项目名称:DriveTimeScaffolding,代码行数:39,代码来源:CustomViewModel.cs


示例6: GetInstalledPackages

        internal static IEnumerable<IVsPackageMetadata> GetInstalledPackages(CodeGenerationContext context)
        {
            var packageInstallerServices = context.ServiceProvider
                .GetService<IComponentModel, SComponentModel>().GetService<IVsPackageInstallerServices>();

            return packageInstallerServices.GetInstalledPackages(context.ActiveProject);
        }
开发者ID:TomDu,项目名称:lab,代码行数:7,代码来源:PackageVersions.cs


示例7: FieldGenerator

 /// <summary>
 /// Constructor for the custom code generator
 /// </summary>
 /// <param name="context">Context of the current code generation operation based on how scaffolder was invoked(such as selected project/folder) </param>
 /// <param name="information">Code generation information that is defined in the factory class.</param>
 public FieldGenerator(
     CodeGenerationContext context,
     CodeGeneratorInformation information)
     : base(context, information)
 {
     _viewModel = new FieldViewModel();
 }
开发者ID:OsvaldoJ,项目名称:orchardizer,代码行数:12,代码来源:FieldGenerator.cs


示例8: IsApplicableProject

        private static bool IsApplicableProject(CodeGenerationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (ProjectLanguage.CSharp == context.ActiveProject.GetCodeLanguage())
            {
                FrameworkName targetFramework = null;

                // GetTargetFramework() may:
                // 1) Throw an exception if TargetFramework string is not valid during the internal parsing.
                // 2) Return null if the active project is not null but the TargetFrameworkMoniker is null.
                //
                // Both of them fall into the case in which the mvc scaffolding does not support the target framework.
                try
                {
                    targetFramework = context.ActiveProject.GetTargetFramework();
                }
                catch
                {
                    return false;
                }

                if (targetFramework != null &&
                    targetFramework.Identifier == ".NETFramework" && targetFramework.Version >= new Version(4, 5))
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:TomDu,项目名称:lab,代码行数:34,代码来源:ScaffolderFilter.cs


示例9: Bind

        public static Expression Bind(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression, ParameterExpression zone, ParameterExpression theCopy)
        {
            var builder = new PropertiesToCopyExpressionBinder(codeGenerationContext, expression.Type, zone, theCopy);

            builder.Visit(expression);

            return builder.statements.ToStatementisedGroupedExpression();
        }
开发者ID:samcook,项目名称:Fickle,代码行数:8,代码来源:PropertiesToCopyExpressionBinder.cs


示例10: Build

        public static Expression Build(TypeDefinitionExpression expression, CodeGenerationContext context)
        {
            var builder = new PropertiesToDictionaryExpressionBinder(expression.Type, context);

            builder.Visit(expression);

            return builder.propertySetterExpressions.ToStatementisedGroupedExpression(GroupedExpressionsExpressionStyle.Wide);
        }
开发者ID:samcook,项目名称:Fickle,代码行数:8,代码来源:PropertiesToDictionaryExpressionBinder.cs


示例11: GetWrappedResponseType

        public static Type GetWrappedResponseType(CodeGenerationContext context, Type type)
        {
            if (TypeSystem.IsPrimitiveType(type) ||  type is FickleListType)
            {
                return context.ServiceModel.GetServiceType(GetValueResponseWrapperTypeName(type));
            }

            return type;
        }
开发者ID:samcook,项目名称:Fickle,代码行数:9,代码来源:ObjectiveBinderHelpers.cs


示例12: IsSupported

        /// <summary>
        /// Provides a way to check if the custom scaffolder is valid under this context
        /// </summary>
        /// <param name="codeGenerationContext">The code generation context</param>
        /// <returns>True if valid, False otherwise</returns>
        public override bool IsSupported(CodeGenerationContext codeGenerationContext)
        {
            if (codeGenerationContext.ActiveProject.CodeModel.Language != EnvDTE.CodeModelLanguageConstants.vsCMLanguageCSharp)
            {
                return false;
            }

            return true;
        }
开发者ID:csengineer13,项目名称:OnionArch-Scaffold,代码行数:14,代码来源:CustomCodeGeneratorFactory.cs


示例13: CustomViewModel

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The code generation context</param>
        public CustomViewModel(CodeGenerationContext context)
        {
            Context = context;
            ICodeTypeService codeTypeService = (ICodeTypeService)Context.ServiceProvider.GetService(typeof(ICodeTypeService));

            this.ModelTypes = codeTypeService.GetAllCodeTypes(Context.ActiveProject)
                //.Where(codeType => codeType.IsValidWebProjectEntityType())
                                            .Where(codeType => codeType.IsDerivedType("System.Web.Http.ApiController"))
                                            .Select(codeType => new ModelType(codeType));
        }
开发者ID:edison1105,项目名称:AngularMVCScaffolder,代码行数:14,代码来源:CustomViewModel.cs


示例14: ScaffolderModel

        protected ScaffolderModel(CodeGenerationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            Context = context;
            ServiceProvider = context.ServiceProvider;
        }
开发者ID:haxard,项目名称:lab,代码行数:10,代码来源:ScaffolderModel.cs


示例15: EnsureDependencyInstalled

        public FrameworkDependencyStatus EnsureDependencyInstalled(CodeGenerationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ODataDependencyInstaller dependencyInstaller = new ODataDependencyInstaller(context, VisualStudioIntegration);
            return dependencyInstaller.Install();
        }
开发者ID:haxard,项目名称:lab,代码行数:10,代码来源:ODataFrameworkDependency.cs


示例16: GenerateGateway

        protected override void GenerateGateway(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".java"))
            {
                var classFileExpression = GatewayExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new JavaCodeGenerator(writer);

                codeGenerator.Generate(classFileExpression);
            }
        }
开发者ID:samcook,项目名称:Fickle,代码行数:11,代码来源:JavaServiceModelCodeGenerator.cs


示例17: GenerateEnum

        protected override void GenerateEnum(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var enumFileExpression = EnumHeaderExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(enumFileExpression);
            }
        }
开发者ID:samcook,项目名称:Fickle,代码行数:11,代码来源:ObjectiveServiceModelCodeGenerator.cs


示例18: IsSupported

        // We support CSharp WAPs targetting at least .Net Framework 4.5 or above.
        // We DON'T currently support VB
        public override bool IsSupported(CodeGenerationContext codeGenerationContext)
        {
            if (ProjectLanguage.CSharp.Equals(codeGenerationContext.ActiveProject.GetCodeLanguage()) )
            {
                FrameworkName targetFramework = codeGenerationContext.ActiveProject.GetTargetFramework();
                return (targetFramework != null) &&
                        String.Equals(".NetFramework", targetFramework.Identifier, StringComparison.OrdinalIgnoreCase) &&
                        targetFramework.Version >= new Version(4, 5);
            }

            return false;
        }
开发者ID:huoxudong125,项目名称:MVC5-Scaffolder,代码行数:14,代码来源:MvcScaffolderFactory.cs


示例19: DisplayScaffolders

        private static bool DisplayScaffolders(CodeGenerationContext context, string projectReferenceName, Version minVersion, Version maxExcludedVersion)
        {
            if (IsApplicableProject(context))
            {
                var referenceDetails = IsValidProjectReference(context, projectReferenceName, minVersion, maxExcludedVersion);

                // We want to show when the reference exists and is of supported version
                // or when the reference does not exist.
                return referenceDetails != ReferenceDetails.ReferenceVersionNotSupported;
            }

            return false;
        }
开发者ID:TomDu,项目名称:lab,代码行数:13,代码来源:ScaffolderFilter.cs


示例20: IsDependencyInstalled

        public bool IsDependencyInstalled(CodeGenerationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool isODataRestierAssemblyReferenced = ProjectReferences.IsAssemblyReferenced(context.ActiveProject, AssemblyVersions.ODataRestierAssemblyName);
            context.Items[ContextKeys.IsODataRestierAssemblyReferencedKey] = isODataRestierAssemblyReferenced;

            bool isEntityFrameworkAssemblyReferenced = ProjectReferences.IsAssemblyReferenced(context.ActiveProject, AssemblyVersions.EntityFrameworkAssemblyName);
            context.Items[ContextKeys.IsEntityFrameworkAssemblyReferencedKey] = isEntityFrameworkAssemblyReferenced;

            return isODataRestierAssemblyReferenced && isEntityFrameworkAssemblyReferenced;
        }
开发者ID:TomDu,项目名称:lab,代码行数:15,代码来源:ODataFrameworkDependency.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CodeGenerationOptions类代码示例发布时间:2022-05-24
下一篇:
C# CodeGenContext类代码示例发布时间: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