DEV Community

Discussion on: Implement Repository Base and Unit of Work in C#

Collapse
 
1001binary profile image
1001binary

Thanks!

A good question :). However, integrating dependency injection is out of scope of this post.

A couple of following steps could help you extend UnitOfWork.

  • Choose one of best .NET IoCs (Ninject, Autofac,...) for your needs. If you are using ASP.NET Core, simply skip this step.
  • Register UnitOfWork, StudentDbContext, repositories and services.
  • Remove The "dbContext" constructor parameter from UnitOfWork.
  • Inject repositories and services into UnitOfWork.