Refactored data provider service registrations#31
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors how data providers are registered and resolved, replacing the custom ProviderRegistration approach with keyed DI registrations and factories. Major updates include renaming configuration properties, introducing MongoClientProvider, and simplifying constructors in MongoDB/EF providers.
- Replace
ProviderRegistrationwith keyed service descriptors inDataProviderBuilderExtensions - Update
DataProviderResolverto directly resolve viaIEnumerable<IDataProvider> - Rename
Database→DatabaseNamein options and wire upMongoClientProvider
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/AppCoreNet.Data/DependencyInjection/DataProviderBuilderExtensions.cs | Replaced custom registrations with keyed DI patterns |
| src/AppCoreNet.Data/DataProviderResolver.cs | Simplified resolution logic, updated error message |
| src/AppCoreNet.Data.MongoDB/MongoRepository.cs | Added overridable GetPrimaryKey for complex IDs |
| src/AppCoreNet.Data.MongoDB/DependencyInjection/MongoDataProviderBuilderExtensions.cs | Introduced MongoClientProvider and updated builder |
| test/AppCoreNet.Data.MongoDB.Tests/MongoTestEntity2Repository.cs | Added unused usings and left commented-out override stub |
Comments suppressed due to low confidence (2)
src/AppCoreNet.Data/DataProviderResolver.cs:27
- [nitpick] The exception message could be clearer if it follows the pattern in other providers, e.g.
Data provider with name '{name}' is not registered.for consistency.
throw new InvalidOperationException($"There is no data provider registered with '{name}'.");
src/AppCoreNet.Data.MongoDB/MongoRepository.cs:157
- You've introduced a customizable
GetPrimaryKeymethod; consider adding unit tests covering primitive,Guid, and complex ID scenarios to ensure correct BSON conversion.
protected virtual BsonValue GetPrimaryKey(TId id)
test/AppCoreNet.Data.MongoDB.Tests/MongoTestEntity2Repository.cs
Outdated
Show resolved
Hide resolved
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.
Closes #27