@@ -65,7 +65,7 @@ public SolutionComponentService(ServiceClient client, IConfiguration configurati
6565 _logger = logger ;
6666 }
6767
68- public IEnumerable < ComponentInfo > GetAllSolutionComponents ( List < Guid > solutionIds )
68+ public async Task < IEnumerable < ComponentInfo > > GetAllSolutionComponentsAsync ( List < Guid > solutionIds )
6969 {
7070 _logger . LogInformation ( $ "[{ DateTime . Now : yyyy-MM-dd HH:mm:ss.fff} ] Getting all solution components for solutions: { string . Join ( ", " , solutionIds ) } ") ;
7171 var allComponents = new HashSet < ComponentInfo > ( ) ;
@@ -74,7 +74,7 @@ public IEnumerable<ComponentInfo> GetAllSolutionComponents(List<Guid> solutionId
7474 IEnumerable < SolutionComponentInfo > explicitComponents ;
7575 try
7676 {
77- explicitComponents = GetExplicitComponents ( solutionIds ) ;
77+ explicitComponents = await GetExplicitComponentsAsync ( solutionIds ) ;
7878 _logger . LogInformation ( $ "[{ DateTime . Now : yyyy-MM-dd HH:mm:ss.fff} ] Found { explicitComponents . Count ( ) } explicit components") ;
7979 }
8080 catch ( Exception ex )
@@ -118,7 +118,7 @@ public IEnumerable<ComponentInfo> GetAllSolutionComponents(List<Guid> solutionId
118118 _logger . LogInformation ( $ "[{ DateTime . Now : yyyy-MM-dd HH:mm:ss.fff} ] Retrieving component information for { requiredNodeIds . Count } dependency nodes") ;
119119
120120 // Retrieve component node information
121- var componentNodes = GetComponentNodes ( requiredNodeIds ) ;
121+ var componentNodes = await GetComponentNodesAsync ( requiredNodeIds ) ;
122122 _logger . LogInformation ( $ "[{ DateTime . Now : yyyy-MM-dd HH:mm:ss.fff} ] Retrieved { componentNodes . Count } component nodes") ;
123123
124124 // Add required components as implicit
@@ -152,7 +152,7 @@ public IEnumerable<ComponentInfo> GetAllSolutionComponents(List<Guid> solutionId
152152 return allComponents ;
153153 }
154154
155- private IEnumerable < SolutionComponentInfo > GetExplicitComponents ( List < Guid > solutionIds )
155+ private async Task < IEnumerable < SolutionComponentInfo > > GetExplicitComponentsAsync ( List < Guid > solutionIds )
156156 {
157157 var query = new QueryExpression ( "solutioncomponent" )
158158 {
@@ -167,16 +167,16 @@ private IEnumerable<SolutionComponentInfo> GetExplicitComponents(List<Guid> solu
167167 }
168168 } ;
169169
170- return _client . RetrieveMultiple ( query ) . Entities
171- . Select ( e => new SolutionComponentInfo (
172- e . GetAttributeValue < Guid > ( "objectid" ) ,
173- e . GetAttributeValue < Guid > ( "solutioncomponentid" ) ,
174- e . GetAttributeValue < OptionSetValue > ( "componenttype" ) . Value ,
175- e . Contains ( "rootcomponentbehavior" ) ? e . GetAttributeValue < OptionSetValue > ( "rootcomponentbehavior" ) . Value : - 1 ,
176- e . GetAttributeValue < EntityReference > ( "solutionid" ) ) ) ;
170+ var entities = await _client . RetrieveAllAsync ( query ) ;
171+ return entities . Select ( e => new SolutionComponentInfo (
172+ e . GetAttributeValue < Guid > ( "objectid" ) ,
173+ e . GetAttributeValue < Guid > ( "solutioncomponentid" ) ,
174+ e . GetAttributeValue < OptionSetValue > ( "componenttype" ) . Value ,
175+ e . Contains ( "rootcomponentbehavior" ) ? e . GetAttributeValue < OptionSetValue > ( "rootcomponentbehavior" ) . Value : - 1 ,
176+ e . GetAttributeValue < EntityReference > ( "solutionid" ) ) ) ;
177177 }
178178
179- private List < ComponentNodeInfo > GetComponentNodes ( List < Guid > nodeIds )
179+ private async Task < List < ComponentNodeInfo > > GetComponentNodesAsync ( List < Guid > nodeIds )
180180 {
181181 if ( ! nodeIds . Any ( ) )
182182 {
@@ -198,8 +198,8 @@ private List<ComponentNodeInfo> GetComponentNodes(List<Guid> nodeIds)
198198
199199 try
200200 {
201- var response = _client . RetrieveMultiple ( query ) ;
202- foreach ( var entity in response . Entities )
201+ var entities = await _client . RetrieveAllAsync ( query ) ;
202+ foreach ( var entity in entities )
203203 {
204204 results . Add ( new ComponentNodeInfo (
205205 entity . GetAttributeValue < Guid > ( "dependencynodeid" ) ,
@@ -374,7 +374,7 @@ private HashSet<DependencyInfo> GetRequiredComponents(IEnumerable<SolutionCompon
374374 /// </summary>
375375 /// <param name="attributeComponents">List of attribute components to check for dependencies</param>
376376 /// <returns>Dictionary mapping attribute ObjectId to list of workflow ObjectIds that depend on it</returns>
377- public Dictionary < Guid , List < Guid > > GetWorkflowDependenciesForAttributes ( IEnumerable < SolutionComponentInfo > attributeComponents )
377+ public async Task < Dictionary < Guid , List < Guid > > > GetWorkflowDependenciesForAttributesAsync ( IEnumerable < SolutionComponentInfo > attributeComponents )
378378 {
379379 var workflowDependencies = new Dictionary < Guid , List < Guid > > ( ) ;
380380
@@ -406,7 +406,7 @@ public Dictionary<Guid, List<Guid>> GetWorkflowDependenciesForAttributes(IEnumer
406406 return workflowDependencies ;
407407
408408 // Retrieve component node information for all nodes
409- var allNodes = GetComponentNodes ( allNodeIds ) ;
409+ var allNodes = await GetComponentNodesAsync ( allNodeIds ) ;
410410
411411 // Filter to only workflow components (type 29)
412412 var workflowNodes = allNodes . Where ( n => n . ComponentType == 29 ) . ToList ( ) ;
0 commit comments