DAL has a number of repositories. All repositories can be divided into logical groups that define some behavior. Should you create a single UnitOfWork class for all repositories, or is it better to create several (IdentityUnitOfWork, etc.)?
- Alexander, could you describe the problem in more detail: 1. what makes it necessary to create UoW subclasses, what do you donate by abandoning the subclasses? 2. can you provide code snippets, for example, interfaces UoW and one of the repositories, a brief example of the use case. - Gleb Ikonnikov
- @ kimaman2, I’m using option 2, but I didn’t get to stick around with interfaces to get just the right pieces. This is exactly what I need. Thank! - Alexander
- If not difficult to mark as an answer :) shuffled from koment to answers .... - kimaman2
|
1 answer
There are 2 possible solutions, in my opinion: either you create repositories using the uow.CreateReposoty method and then you have a large monolith, or the same monolith, but with a bunch of properties like IItem1Repository It1Repository {get; }, with the second approach, UoW can be stuck around with interfaces and in each service only the necessary piece can be dragged (ps I have 1 option in prod, but I would prefer 2, it's a pity that does not depend on me)
|