當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeGenerationContext類代碼示例

本文整理匯總了C#中CodeGenerationContext的典型用法代碼示例。如果您正苦於以下問題:C# CodeGenerationContext類的具體用法?C# CodeGenerationContext怎麽用?C# CodeGenerationContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CodeGenerationContext類屬於命名空間,在下文中一共展示了CodeGenerationContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的CodeGenerationContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。