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); }
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))); }
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))); }
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)); }
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); }