A web application where psychotherapists who specialize in their field can answer questions asked to them on this platform.
I used:
Architectural Building
The project consists of two layers. Persistence Layer, which is associated with the Database, and Core Layer, which is not associated with the Database
Controller => Core <= Persistence
We can talk about a dependency diagram like this. The Core Layer contains Interface classes. Persistence contains the classes in which I define these interfaces. On the Controller side, I used the UnitOfWork class to reduce the Controller DBContext dependency. However, although the controller was a high-level layer, it was tightly coupled with UnitOfWork, a low-level layer. I used the IUnitOfWork class for this. IUnitOfWork defines a completely abstract class that contains IRepository's. Then I made the UnitOfWork class dependent on the IUnitOfWork class. Likewise, I created a dependency between the Controller layer and IUnitOfWork .
Controller => IUnitOfWork <= UnitOfWork
Now the Controller hig-level layer is dependent on an Abstract class. Likewise, in UnitOfWork, which is a low-level and detailed class, Abstrack has become dependent on a class. Actually, what I did was to make the Core Layer completely independent. The testability of the application has increased. In addition, the Core Layer has a structure independent of the ORM Framework. The change to be made in UnitOfWork will not affect the IUnitOfWork Layer.
On the other hand, in the application, the DbContext dependency was still continuing in the UnitOfWork Layer . This indirectly caused the Controller - DbContext tightly coupled problem. I used a Dependency Injection Framework to solve this. (Ninject 3.2.1.0)