Step 1 Create the interface class for the generic repository because my sample project reference has a few differences, so the project has must follow the circular dependency rules. The sample project can’t directly reference the infra project, and it needs to be roundabout to design, but this method has other advantages. This name sets “IUntiOfWorkRepository.”
Step 2 Create the UntiOfWorkRepositoryServices class files, which inherit the IUntiOfWorkRepository file and follow the dependency injection rules.
Step 3 Create the interface class files for the database table repository, which keeps following the generic type mechanism because this idea can expand program flexibility- for example, the generic type can put the data transfer object(DTO) class on the output side. The database table entity class can set the default objects for the generic repository class. This filename specifies “IDemoUnitOfWork.”
Step 4 Create the repository class file for the business logic layer(BLL), which inherits the UntiOfWorkRepositoryServices class objects and the IDemoUnitOfWork interface objects, which means the repository packages the database table-related business logic. The business logic layer(BLL) services must use the block concept, which means the data accessed via the packaged object- for example, the buying goods operation must use the buying-related unit of work, then next one use the order-related unit of work and the shipping-related unit of work, which mean can’t reverse order operation. This filename sets “DemoUnitOfWork.” Other blog bodies will descript the UntiOfWorkRepositoryServices class here should descript the generic repository class, and IDemoUnitOfWork should descript the database table communications. This implemented sample will focus on the business logic unit of the work application.
The single-responsibility principle (SRP) is a computer-programming principle that states that every module, class or…
Command query responsibility segregation (CQRS) generalizes CQS to message-driven and event-driven architectures: it applies the CQS…
Domain-driven design (DDD) is a software design approach focusing on modelling software to match a…
A microservice architecture – a variant of the service-oriented architecture (SOA) structural style – arranges…
Visitor – It allows the program changes the algorithm and the operations that base on the visitor…
Template method – It means the program defines an algorithm skeleton in the superclass, which lets subclasses…