-
Notifications
You must be signed in to change notification settings - Fork 1
_π οΈ Refactor suggestion_Β #106
Copy link
Copy link
Open
Description
π οΈ Refactor suggestion
Application layer now imports an Infrastructure-level namespace β breaks clean architecture boundaries
Adding using Dentizone.Infrastructure; couples the Application project to the Infrastructure project. In a layered / clean-architecture setup, dependencies must point outwards (Infrastructure β Application), never the other way around.
This single using will force the compiler to reference the Infrastructure assembly and may create circular-dependency headaches the moment Infrastructure needs types from Application (which it usually does).
Proposed direction (no direct patch here because it spans multiple projects):
- Define a lightweight
IAppDbContext(orIDbContext) interface in the Application layer exposing only what the services need (Database,Set<TEntity>(), etc.). - Have
AppDbContextin Infrastructure implement that interface. - Inject
IAppDbContextinto services instead of the concreteAppDbContext. - Remove this
using Dentizone.Infrastructure;directive; the Application layer should only know the abstraction.
π€ Prompt for AI Agents
In Dentizone.Application/Services/UserService.cs at line 10, remove the using
directive for Dentizone.Infrastructure to avoid breaking clean architecture
boundaries. Instead, define an interface like IAppDbContext in the Application
layer that exposes only the necessary database operations. Modify the
Infrastructure project's AppDbContext to implement this interface. Refactor
UserService to depend on the IAppDbContext abstraction via dependency injection
rather than the concrete AppDbContext, thus eliminating the direct
Infrastructure reference.
Originally posted by @coderabbitai[bot] in #104 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels