Skip to content

Refactor IContentDefinitionService for Improved Modularity and Design #18235

@MikeAlhayek

Description

@MikeAlhayek

Current Problem:

The IContentDefinitionService interface is currently part of the Module project. This setup is suboptimal because any other project that wants to use this service (e.g., to manage content definitions such as deleting a content type) would be forced to reference the Module project directly. This introduces unnecessary coupling and goes against clean architecture principles.

Proposed Solution:

  • Move the IContentDefinitionService interface to the ContentType.Abstractions project to decouple it from implementation details and module-specific logic.
  • Refactor the service so that it returns domain models instead of ViewModels, as returning ViewModels from a service layer breaks separation of concerns and leads to poor design.
  • Update all affected code to reflect the refactoring and maintain consistency.

Benefits:

  • Promotes better separation of concerns and a cleaner architecture.
  • Avoids unnecessary dependencies on the Module project.
  • Improves reusability and makes the service accessible to other projects without introducing tight coupling.

@hishamco are you interested in making this PR? If not, I’ll do it when time permits. But it needs to be done for v3 since it will have breaking change.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions