Skip to content

Separation of the Persistence Layer from Infrastructure #61

@ParsaMehdipour

Description

@ParsaMehdipour

Hi there,

While reviewing the architecture of the project, I noticed that the persistence layer is currently integrated within the Infrastructure project. Although this approach can work for simpler applications, it may lead to a tighter coupling of concerns as the system evolves.

To improve modularity and maintainability, I suggest separating the persistence logic (e.g., DbContext, repository implementations, entity configurations) into its own dedicated project, such as ProjectName.Persistence. This separation would:

  • Align with the principles of clean architecture by isolating infrastructure concerns from data access logic.
  • Make it easier to swap or mock the persistence layer for testing purposes.
  • Improve clarity by enforcing a clear boundary between data access and other infrastructure services (e.g., email, file storage, logging).

Let me know your thoughts on this. If the team agrees, I’m happy to help with the refactoring effort or propose a possible structure for the new project layout.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions