コード例 #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";
            }
        }
コード例 #2
0
        protected override async Task <List <SystemForm> > GetSystemFormAsync(IOrganizationServiceExtented service)
        {
            List <SystemForm> result = new List <SystemForm>();

            var descriptor = new SolutionComponentDescriptor(service);
            var repository = new SystemFormRepository(service);

            var imageComponents = _solutionImage.Components.Where(c => c.ComponentType == (int)ComponentType.SystemForm);

            if (imageComponents.Any())
            {
                var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

                if (solutionComponents.Any())
                {
                    var tempList = await repository.GetListByIdListAsync(solutionComponents.Select(s => s.ObjectId.Value), new ColumnSet(true));

                    result.AddRange(tempList);
                }
            }

            var hashSet = new HashSet <Guid>(result.Select(c => c.Id));

            imageComponents = _solutionImage.Components.Where(c => c.ComponentType == (int)ComponentType.Entity);

            if (imageComponents.Any())
            {
                var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

                if (solutionComponents.Any())
                {
                    var entities = solutionComponents
                                   .Where(c => c.RootComponentBehaviorEnum.GetValueOrDefault(SolutionComponent.Schema.OptionSets.rootcomponentbehavior.Include_Subcomponents_0) == SolutionComponent.Schema.OptionSets.rootcomponentbehavior.Include_Subcomponents_0 &&
                                          c.ObjectId.HasValue)
                                   .Select(e => descriptor.MetadataSource.GetEntityMetadata(e.ObjectId.Value))
                                   .Where(e => e != null)
                                   .Select(e => e.LogicalName)
                                   .ToArray();

                    if (entities.Any())
                    {
                        var tempList = await repository.GetListForEntitiesAsync(entities, new ColumnSet(true));

                        foreach (var item in tempList)
                        {
                            if (hashSet.Add(item.Id))
                            {
                                result.Add(item);
                            }
                        }
                    }
                }
            }

            return(result);
        }
コード例 #3
0
 public SolutionDescriptor(
     IWriteToOutput iWriteToOutput
     , IOrganizationServiceExtented service
     , SolutionComponentDescriptor descriptor
     )
 {
     this._iWriteToOutput = iWriteToOutput;
     this._service        = service;
     this._descriptor     = descriptor;
 }
コード例 #4
0
        private async Task <List <OptionSetMetadata> > GetOptionSet(IOrganizationServiceExtented service, IEnumerable <SolutionImageComponent> imageComponents)
        {
            var descriptor = new SolutionComponentDescriptor(service);

            var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

            if (!solutionComponents.Any())
            {
                return(new List <OptionSetMetadata>());
            }

            return(await new OptionSetRepository(service).GetListByIdListAsync(solutionComponents.Select(s => s.ObjectId.Value)));
        }
コード例 #5
0
        private async Task <List <SdkMessageProcessingStep> > GetSdkMessageProcessingStep(IOrganizationServiceExtented service, IEnumerable <SolutionImageComponent> imageComponents)
        {
            var descriptor = new SolutionComponentDescriptor(service);

            var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

            if (!solutionComponents.Any())
            {
                return(new List <SdkMessageProcessingStep>());
            }

            return(await new SdkMessageProcessingStepRepository(service).GetListByIdListAsync(solutionComponents.Select(s => s.ObjectId.Value), new ColumnSet(true)));
        }
コード例 #6
0
        private async Task <List <PluginAssembly> > GetPluginAssembly(IOrganizationServiceExtented service, IEnumerable <SolutionImageComponent> imageComponents)
        {
            var descriptor = new SolutionComponentDescriptor(service);

            var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

            if (!solutionComponents.Any())
            {
                return(new List <PluginAssembly>());
            }

            return(await new PluginAssemblyRepository(service).GetListByIdListAsync(solutionComponents.Select(s => s.ObjectId.Value), null));
        }
        private static async Task <List <SiteMap> > GetSiteMap(IOrganizationServiceExtented service, IEnumerable <SolutionImageComponent> imageComponents)
        {
            var descriptor = new SolutionComponentDescriptor(service);

            var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

            if (!solutionComponents.Any())
            {
                return(new List <SiteMap>());
            }

            return(await new SiteMapRepository(service).GetListByIdListAsync(solutionComponents.Select(s => s.ObjectId.Value), ColumnSetInstances.AllColumns));
        }
コード例 #8
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);
        }
        public CreateFileWithEntityMetadataJavaScriptHandler(
            TextWriter writer
            , CreateFileJavaScriptConfiguration config
            , IOrganizationServiceExtented service
            ) : base(writer, config.TabSpacer, true)
        {
            this._config  = config;
            this._service = service;

            this._solutionComponentDescriptor = new SolutionComponentDescriptor(_service)
            {
                WithManagedInfo = false,
            };

            if (_config.WithDependentComponents)
            {
                this._dependencyRepository = new DependencyRepository(_service);
                this._descriptorHandler    = new DependencyDescriptionHandler(_solutionComponentDescriptor);
            }
        }
        public OrganizationDifferenceImageBuilder(IOrganizationServiceExtented service1, IOrganizationServiceExtented service2)
        {
            this._service1 = service1;
            this._service2 = service2;

            this.Descriptor1 = new SolutionComponentDescriptor(this._service1)
            {
                WithManagedInfo   = false,
                WithSolutionsInfo = false,
                WithUrls          = true,
            };
            this.Descriptor2 = new SolutionComponentDescriptor(this._service2)
            {
                WithManagedInfo   = false,
                WithSolutionsInfo = false,
                WithUrls          = true,
            };

            this._componentsOnlyIn1   = new HashSet <SolutionComponent>();
            this._componentsOnlyIn2   = new HashSet <SolutionComponent>();
            this._componentsDifferent = new TupleList <SolutionComponent, SolutionComponent, string>();
        }
コード例 #11
0
        protected override async Task <List <EntityMetadata> > GetEntityMetadataCollection2InternalAsync()
        {
            var imageComponents = _solutionImage.Components.Where(c => c.ComponentType == (int)ComponentType.Entity);

            if (!imageComponents.Any())
            {
                this._EntityMetadataCollection2 = new List <EntityMetadata>();

                return(this._EntityMetadataCollection2);
            }

            await InitializeConnection(null, null);

            var descriptor = new SolutionComponentDescriptor(this.Service2);

            var solutionComponents = await descriptor.GetSolutionComponentsListAsync(imageComponents);

            if (!solutionComponents.Any())
            {
                this._EntityMetadataCollection2 = new List <EntityMetadata>();

                return(this._EntityMetadataCollection2);
            }

            var entityQueryExpression = new EntityQueryExpression()
            {
                Properties = new MetadataPropertiesExpression()
                {
                    AllProperties = true
                },
                AttributeQuery = new AttributeQueryExpression()
                {
                    Properties = new MetadataPropertiesExpression()
                    {
                        AllProperties = true
                    }
                },
                RelationshipQuery = new RelationshipQueryExpression()
                {
                    Properties = new MetadataPropertiesExpression()
                    {
                        AllProperties = true
                    }
                },
                LabelQuery = new LabelQueryExpression(),

                Criteria =
                {
                    Conditions =
                    {
                        new MetadataConditionExpression("MetadataId", MetadataConditionOperator.In, solutionComponents.Select(c => c.ObjectId.Value).ToArray()),
                    },
                },
            };

            var isEntityKeyExists = this.Service2.IsRequestExists(SdkMessageRequest.Instances.RetrieveEntityKeyRequest);

            if (isEntityKeyExists)
            {
                entityQueryExpression.KeyQuery = new EntityKeyQueryExpression()
                {
                    Properties = new MetadataPropertiesExpression()
                    {
                        AllProperties = true
                    }
                };
            }

            var response = (RetrieveMetadataChangesResponse)this.Service2.Execute(
                new RetrieveMetadataChangesRequest()
            {
                ClientVersionStamp = null,
                Query = entityQueryExpression,
            }
                );

            this._EntityMetadataCollection2 = response.EntityMetadata.ToList();

            return(this._EntityMetadataCollection2);
        }
コード例 #12
0
 public EntityAttributesDependentComponentsHandler(DependencyRepository dependencyRepository, SolutionComponentDescriptor descriptor, DependencyDescriptionHandler descriptorHandler)
 {
     this._dependencyRepository = dependencyRepository;
     this._descriptor           = descriptor;
     this._descriptorHandler    = descriptorHandler;
 }
コード例 #13
0
 public SolutionComponentConverter(SolutionComponentDescriptor descriptor)
 {
     this._descriptor = descriptor;
 }
コード例 #14
0
 public DependencyDescriptionHandler(SolutionComponentDescriptor descriptor)
 {
     this._descriptor = descriptor;
 }