I Want to Talk Repositories
I'm not sure that I've seen a more hotly debated topic other than the repository and unit-of-work pattern in dotnet. This is especially relevant in ASP.NET and when working with entity framework.
I am still undecided on the necessity of repositories.
I'd like to hear from the community on what practices you follow and why!
A few arguments about repo and UoW that we see a lot:
- EF DbSet works like a repository anyway.
- EF DbContext works like a UoW anyway.
- Reusable queries can be place on extension methods for DbSet<T>.
- DbSet methods return IQueryable that encourage developers to extend queries throughout the application.
- Repositories allow you to slightly decouple from your persistence framework.
- Projects rarely switch persistence frameworks without other major application changes.
0 comments:
Post a Comment