-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
ADR 001 Use EFCore In Application Layer
Using Entity Framework Core Directly in the Application Layer
Accepted
In the context of implementing Clean Architecture, a decision needs to be made regarding the use of Entity Framework Core (EF Core) for data access. Specifically, whether to use EF Core directly in the Application layer or to abstract it away using patterns like Repository or Unit of Work.
We have decided to use Entity Framework Core directly in the Application layer of our Clean Architecture implementation.
- Simplicity: Simplifies the architecture by reducing the number of abstractions between application logic and data access.
- Performance: Potentially improves performance due to fewer layers of abstraction.
- Ease of Development: Allows developers to leverage the full capabilities of EF Core without adapting to custom abstractions.
- Rapid Development: Speeds up the development process, especially in the early stages of the project.
- Training and Learning Curve: Using EF Core directly in the Application layer could reduce the learning curve for new developers, as they would only need to understand EF Core, rather than additional abstractions.
- Maintenance: Direct use of EF Core could potentially simplify maintenance, as there would be fewer layers to debug.
- Tight Coupling: Creates tight coupling between application logic and data access technology, making it harder to switch ORMs or data access strategies in the future.
- Testability: Makes unit testing more challenging, as mocking EF Core's DbContext or using an in-memory database may be required.
- Separation of Concerns: Blurs the lines between application logic and data access, potentially violating the principle of separation of concerns.
- Leakage of Data Access Concerns: Business logic may become intertwined with data access concerns, cluttering the Application layer.
The decision to use EF Core directly in the Application layer is driven by the desire for simplicity and rapid development in the early stages of the project. While there are trade-offs in terms of tight coupling and testability, these are deemed acceptable given the project's current scope and priorities.