New interfaces#2
Merged
Merged
Conversation
magesoe
commented
Jun 5, 2025
Contributor
- Added extension method that adds the interfaces ServiceClient implements
- Added extension method that adds a ServiceClientFactory
…and update README with usage examples
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new interfaces and extension methods to enhance how ServiceClient instances are registered and resolved, including a new factory pattern for scenarios that require multiple or long-running client instances.
- Adds documentation in the README.md for using ServiceClientFactory.
- Updates DI registration in Program.cs with new interfaces and a factory.
- Introduces new extension methods and supporting files in the DataverseConnection library to create and manage ServiceClient instances.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updated docs with instructions on using ServiceClientFactory for advanced scenarios. |
| DataverseWhoAmI/Program.cs | Updated sample code to resolve ServiceClient via different interfaces and the factory. |
| DataverseConnection/ServiceCollectionExtensions.cs | Added extension methods to register both ServiceClient and organization service interfaces plus factory. |
| DataverseConnection/ServiceClientFactory.cs | Added a new factory class implementing IServiceClientFactory for creating new ServiceClient instances. |
| DataverseConnection/Internal/ServiceClientBuilder.cs | Updated internal builder logic with new C# syntax for array initialization in the token provider. |
| DataverseConnection/IServiceClientFactory.cs | Added a new factory interface for creating ServiceClient instances. |
| DataverseConnection/DataverseConnection.csproj | Updated dependency for Microsoft.Extensions.Caching.Memory from version 8.0.0 to 9.0.0. |
Comments suppressed due to low confidence (1)
DataverseConnection/Internal/ServiceClientBuilder.cs:41
- [nitpick] The square bracket syntax for array initialization is valid in C# 12; consider adding an inline comment to briefly explain this new syntax to help maintainers unfamiliar with recent language updates.
var tokenRequestContext = new TokenRequestContext([resource]);
… NuGet configuration for local package source
…tory context and updating WhoAmI PackageReference to localpr version
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.