♻️ refactor: extract shared EntityFrameworkUnitOfWork base (document providers) - #3
Merged
Merged
Conversation
…document providers The MongoDb and (incoming) CosmosDb unit of works were near-identical copies of the same ~200 lines of store-agnostic IQueryableUnitOfWork boilerplate (Commit, GetRepository, ApplyCurrentValues, LoadCollection, Dispose, ...). Extracts that into an abstract EntityFrameworkUnitOfWork in the base package, with a single abstract CreateSetCore<TEntity>() each provider overrides to build its own Set. MongoDb's unit of work drops to ~15 lines. The relational providers keep RelationalUnitOfWork (it also is a raw-SQL executor, a separate concern). Behaviour is unchanged; base/Relational/SqlServer/MongoDb build and all 30 tests pass.
…r the shared UnitOfWork The base package gained the shared EntityFrameworkUnitOfWork (additive), so it must be republished for the document providers (which now derive from it) to resolve at runtime. MongoDb is bumped to publish its thinned unit of work. The relational providers are unchanged.
|
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.



What
Extracts the store-agnostic
IQueryableUnitOfWorkboilerplate — repeated almost verbatim in the MongoDb (and incoming CosmosDb) unit of works — into an abstractEntityFrameworkUnitOfWorkin the base package. Each document provider now overrides a singleCreateSetCore<TEntity>()to build its ownSet; MongoDb's unit of work drops from ~245 lines to ~15.Why
The relational providers keep
RelationalUnitOfWorkas-is — it is also a raw-SQL executor (RelationalSqlExecutor), a separate concern, and uses different field names so it was never part of the duplication.Verification
Behaviour-neutral. base / Relational / SqlServer / MongoDb build on net8 + net10; all 30 tests pass (base 9, SqlServer 18, MongoDb 3).