-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new query abstractions for retrieving entity metadata (#876)
- Loading branch information
Showing
7 changed files
with
49 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/Queries/GetEntityMetadataQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Microsoft.Xrm.Sdk.Metadata; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
public record GetEntityMetadataQuery(string EntityLogicalName, EntityFilters EntityFilters = EntityFilters.Default) : ICrmQuery<EntityMetadata>; |
20 changes: 20 additions & 0 deletions
20
...gRecordSystem/src/TeachingRecordSystem.Core/Dqt/QueryHandlers/GetEntityMetadataHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.PowerPlatform.Dataverse.Client; | ||
using Microsoft.Xrm.Sdk.Messages; | ||
using Microsoft.Xrm.Sdk.Metadata; | ||
using TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.QueryHandlers; | ||
|
||
public class GetEntityMetadataHandler : ICrmQueryHandler<GetEntityMetadataQuery, EntityMetadata> | ||
{ | ||
public async Task<EntityMetadata> Execute(GetEntityMetadataQuery query, IOrganizationServiceAsync organizationService) | ||
{ | ||
var entityResponse = (RetrieveEntityResponse)await organizationService.ExecuteAsync(new RetrieveEntityRequest() | ||
{ | ||
LogicalName = query.EntityLogicalName, | ||
EntityFilters = query.EntityFilters | ||
}); | ||
|
||
return entityResponse.EntityMetadata; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters