Step 5 Create the work interface class files unit, which statement the IDemoUnitOfWork interface variables. It collects the interface class of the BLL and other functions of the generic repository.

Step 6 Create the work service class files unit, which implements the generic repository’s BLL class files and other functions. Don’t write non-related tasks in this file because this class should focus on how to implement the BLL class files and keep clean code rules, and doesn’t should write the non-related source code in it.

Step 7 Create the client-side, which will be used the source code and the files. It keeps following the dependency injection rule and uses the interface class methods, which also can use the abstract class methods, but the interface class method and the abstract method have a few different characteristics. This article doesn’t include its discussion and descript range. The interface class name sets “IUnitOfWorkClientServices.” The service class name sets “UnitOfWorkClientServices.”


Step 8 Create the unit of work pattern-related flies in the web projects, then register the related files in the “Startup.cs.”
// Unit of Work
services.AddScoped(typeof(IUnitOfWorkClientServices<>), typeof(UnitOfWorkClientServices<>));

Reference
- Implementing Unit Of Work And Repository Pattern With Dependency Injection In .Net 5
- Patterns of Enterprise Application Architecture – unit of work
- DOT NET TUTORIALS – Unit Of Work in Repository Pattern
- Programming With Wolfgang – Repository and Unit of Work Pattern