Exemplo n.º 1
0
        public CreateGlobalOptionSetsFileCSharpHandler(
            TextWriter writer
            , IOrganizationServiceExtented service
            , IWriteToOutput iWriteToOutput
            , CreateFileCSharpConfiguration config
            ) : base(writer, config.TabSpacer, config.AllDescriptions)
        {
            this._service        = service ?? throw new ArgumentNullException(nameof(service));
            this._iWriteToOutput = iWriteToOutput ?? throw new ArgumentNullException(nameof(iWriteToOutput));

            this._config = config;

            this._descriptor = new SolutionComponentDescriptor(_service)
            {
                WithManagedInfo = config.WithManagedInfo,
            };

            this._dependencyRepository = new DependencyRepository(this._service);
            this._descriptorHandler    = new DependencyDescriptionHandler(this._descriptor);
            this._repositoryStringMap  = new StringMapRepository(_service);

            if (config.ConstantType == ConstantType.ReadOnlyField)
            {
                _fieldHeader = "static readonly";
            }
            else
            {
                _fieldHeader = "const";
            }
        }
        public static CreateFileCSharpConfiguration CreateForProxyClass(
            string namespaceClasses
            , string namespaceGlobalOptionSets
            , CommonConfiguration commonConfig
            )
        {
            var result = new CreateFileCSharpConfiguration
            {
                TabSpacer = commonConfig.GetTabSpacer(),

                NamespaceClasses          = namespaceClasses,
                NamespaceGlobalOptionSets = namespaceGlobalOptionSets,

                GenerateAttributes           = commonConfig.GenerateProxyClassesAttributes,
                GenerateAttributesWithNameOf = commonConfig.GenerateProxyClassesAttributesWithNameOf,
                GenerateStatus          = commonConfig.GenerateProxyClassesStatusOptionSet,
                GenerateLocalOptionSet  = commonConfig.GenerateProxyClassesLocalOptionSet,
                GenerateGlobalOptionSet = commonConfig.GenerateProxyClassesGlobalOptionSet,
                GenerateOneToMany       = commonConfig.GenerateProxyClassesOneToMany,
                GenerateManyToOne       = commonConfig.GenerateProxyClassesManyToOne,
                GenerateManyToMany      = commonConfig.GenerateProxyClassesManyToMany,

                AllDescriptions         = commonConfig.GenerateCommonAllDescriptions,
                WithDependentComponents = commonConfig.GenerateSchemaEntityOptionSetsWithDependentComponents,

                WithManagedInfo = commonConfig.SolutionComponentWithManagedInfo,

                GenerateWithDebuggerNonUserCode       = commonConfig.GenerateProxyClassesWithDebuggerNonUserCode,
                UseSchemaConstInCSharpAttributes      = commonConfig.GenerateProxyClassesUseSchemaConstInCSharpAttributes,
                WithoutObsoleteAttribute              = commonConfig.GenerateProxyClassesWithoutObsoleteAttribute,
                MakeAllPropertiesEditable             = commonConfig.GenerateProxyClassesMakeAllPropertiesEditable,
                AddConstructorWithAnonymousTypeObject = commonConfig.GenerateProxyClassesAddConstructorWithAnonymousTypeObject,

                GenerateAttributesEnumsStateStatus = commonConfig.GenerateProxyClassesAttributesEnumsStateStatus,
                GenerateAttributesEnumsLocal       = commonConfig.GenerateProxyClassesAttributesEnumsLocal,
                GenerateAttributesEnumsGlobal      = commonConfig.GenerateProxyClassesAttributesEnumsGlobal,

                GenerateAttributesEnumsStateStatusUseSchemaEnum = commonConfig.GenerateProxyClassesAttributesEnumsUseSchemaStateStatusEnum,
                GenerateAttributesEnumsLocalUseSchemaEnum       = commonConfig.GenerateProxyClassesAttributesEnumsUseSchemaLocalEnum,
                GenerateAttributesEnumsGlobalUseSchemaEnum      = commonConfig.GenerateProxyClassesAttributesEnumsUseSchemaGlobalEnum,

                AddDescriptionAttribute = commonConfig.GenerateProxyClassesAddDescriptionAttribute,
            };

            return(result);
        }
        public static CreateFileCSharpConfiguration CreateForSdkMessageRequest(FileGenerationOptions fileGenerationOptions)
        {
            var result = new CreateFileCSharpConfiguration
            {
                TabSpacer = fileGenerationOptions.GetTabSpacer(),

                NamespaceClasses          = fileGenerationOptions.NamespaceSdkMessagesCSharp,
                NamespaceGlobalOptionSets = fileGenerationOptions.NamespaceGlobalOptionSetsCSharp,

                GenerateAttributesWithNameOf = fileGenerationOptions.GenerateSdkMessageRequestAttributesWithNameOf,

                GenerateWithDebuggerNonUserCode = fileGenerationOptions.GenerateSdkMessageRequestWithDebuggerNonUserCode,

                MakeAllPropertiesEditable = fileGenerationOptions.GenerateSdkMessageRequestMakeAllPropertiesEditable,
            };

            return(result);
        }
        public static CreateFileCSharpConfiguration CreateForSchemaEntity(
            string namespaceClasses
            , string namespaceGlobalOptionSets
            , string typeConverterName
            , CommonConfiguration commonConfig
            )
        {
            var result = new CreateFileCSharpConfiguration
            {
                TabSpacer = commonConfig.GetTabSpacer(),

                NamespaceClasses          = namespaceClasses,
                NamespaceGlobalOptionSets = namespaceGlobalOptionSets,

                TypeConverterName = typeConverterName,

                GenerateAttributes      = commonConfig.GenerateSchemaAttributes,
                GenerateStatus          = commonConfig.GenerateSchemaStatusOptionSet,
                GenerateLocalOptionSet  = commonConfig.GenerateSchemaLocalOptionSet,
                GenerateGlobalOptionSet = commonConfig.GenerateSchemaGlobalOptionSet,
                GenerateOneToMany       = commonConfig.GenerateSchemaOneToMany,
                GenerateManyToOne       = commonConfig.GenerateSchemaManyToOne,
                GenerateManyToMany      = commonConfig.GenerateSchemaManyToMany,
                GenerateKeys            = commonConfig.GenerateSchemaKeys,

                AllDescriptions         = commonConfig.GenerateCommonAllDescriptions,
                WithDependentComponents = commonConfig.GenerateSchemaEntityOptionSetsWithDependentComponents,
                ConstantType            = commonConfig.GenerateSchemaConstantType,
                OptionSetExportType     = commonConfig.GenerateSchemaOptionSetExportType,

                GenerateSchemaIntoSchemaClass = commonConfig.GenerateSchemaIntoSchemaClass,
                WithManagedInfo = commonConfig.SolutionComponentWithManagedInfo,

                AddDescriptionAttribute = commonConfig.GenerateSchemaAddDescriptionAttribute,

                AddTypeConverterAttributeForEnums = commonConfig.GenerateSchemaAddTypeConverterAttributeForEnums,
            };

            return(result);
        }
        public static CreateFileCSharpConfiguration CreateForSdkMessageRequest(
            string namespaceClasses
            , string namespaceGlobalOptionSets
            , CommonConfiguration commonConfig
            )
        {
            var result = new CreateFileCSharpConfiguration
            {
                TabSpacer = commonConfig.GetTabSpacer(),

                NamespaceClasses          = namespaceClasses,
                NamespaceGlobalOptionSets = namespaceGlobalOptionSets,

                GenerateAttributesWithNameOf = commonConfig.GenerateSdkMessageRequestAttributesWithNameOf,

                GenerateWithDebuggerNonUserCode = commonConfig.GenerateSdkMessageRequestWithDebuggerNonUserCode,

                MakeAllPropertiesEditable = commonConfig.GenerateSdkMessageRequestMakeAllPropertiesEditable,
            };

            return(result);
        }