Esempio 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";
            }
        }
Esempio n. 2
0
        public OptionSetComparer(string tabSpacer, string connectionName1, string connectionName2, StringMapRepository rep1, StringMapRepository rep2)
        {
            this._tabSpacer       = tabSpacer;
            this._connectionName1 = connectionName1;
            this._connectionName2 = connectionName2;

            this._rep1 = rep1;
            this._rep2 = rep2;
        }
Esempio n. 3
0
        public CreateGlobalOptionSetsFileJavaScriptHandler(
            TextWriter writer
            , IOrganizationServiceExtented service
            , IWriteToOutput iWriteToOutput
            , string tabSpacer
            , bool withDependentComponents
            ) : base(writer, tabSpacer, true)
        {
            this._service                 = service;
            this._iWriteToOutput          = iWriteToOutput;
            this._withDependentComponents = withDependentComponents;

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

            this._repositoryStringMap = new StringMapRepository(_service);
        }
        private async Task CreateFile(string entityLogicalName, EntityMetadata entityMetadata)
        {
            if (entityMetadata == null)
            {
                this._entityMetadata = this._solutionComponentDescriptor.MetadataSource.GetEntityMetadata(entityLogicalName);
            }
            else
            {
                this._entityMetadata = entityMetadata;

                this._solutionComponentDescriptor.MetadataSource.StoreEntityMetadata(entityMetadata);
            }

            var repositoryStringMap = new StringMapRepository(_service);

            this._listStringMap = await repositoryStringMap.GetListAsync(this._entityMetadata.LogicalName);

            string jsNamespace = _config.NamespaceClassesJavaScript;
            string className   = (!string.IsNullOrEmpty(jsNamespace) ? jsNamespace + "." : string.Empty) + _entityMetadata.LogicalName;

            if (_config.GenerateSchemaIntoSchemaClass)
            {
                jsNamespace = className;
                className  += ".Schema";
            }

            WriteCrmDeveloperAttribute(_entityMetadata.LogicalName);

            WriteNamespace(jsNamespace);

            WriteLine("{0} = {{", className);

            WriteAttributesToFile();

            WriteStateStatusEnums();

            await WriteRegularOptionSets();

            WriteLine();
            Write("};");
        }