C#C
C#2y ago
14 replies
M B V R K

Is Okay to Extend the Domain Services by Application Services while implementing DDD

Hi friends,
I'm implementing a project using various advanced concepts, one of these concepts is DDD (Domain Driven Design).
I have these layers Domain, Infrastructure and Application layers.
In the Domain layer I have some Domain Services,
In the Infrastructure as everyone knows I implemented the Repositories
In the Application layer I have Application Services, but here the confusing point for me, beacuse I let the Application Services to extend the Domain Services ( by the inheritance ).

Example:
Domain Service:
public class ExpenseService : IExpenseService
{
  // Some definition goes here
}


Application Service:
public class AppliationExpenseService : ExpenseService
{
  // Some definition goes here
}


Additional info:
In the Application layer I have imlemented the CQRS ( Commands and Queries )

Question:
I'm confusing about letting the implementation as I showed you, or do a better approach.
I asked Github Copilot and it told me that the Application layer should not directly depend on Repositories instead it should depend on Domain Services and the Domain Services should depend on Repositories.

Please share with me your experience about this topic.

Massive thanks in advance <3
Was this page helpful?