C
C#5mo ago
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
}
public class ExpenseService : IExpenseService
{
// Some definition goes here
}
Application Service:
public class AppliationExpenseService : ExpenseService
{
// Some definition goes here
}
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
10 Replies
viceroypenguin
viceroypenguin5mo ago
question: is DDD/Clean Arch something you decides or is this a class requirement, etc?
M B V R K
M B V R K5mo ago
It is my decides
viceroypenguin
viceroypenguin5mo ago
watch these videos: $vsa
viceroypenguin
viceroypenguin5mo ago
would encourage not going down the path of DDD/CA/etc.
M B V R K
M B V R K5mo ago
I already implementing the VSA alongside with CQRS in the Application layer
viceroypenguin
viceroypenguin5mo ago
VSA would encourage removing these "layers". for each endpoint, just have a controller and a handler, and all handlers rely on the dbcontext. use dumb DTOs and dumb DB Entities. and separate DTOs and DB Entities. forget DDD entirely https://github.com/viceroypenguin/VsaTemplate/blob/master/Web/Features/Features/Handlers/CreateFeature.cs an example of how i do it
M B V R K
M B V R K5mo ago
Yeah, that is very very good, I have implemented the VSA in another project I found it fine, but in this project I want to continue with DDD
viceroypenguin
viceroypenguin5mo ago
a) why? b) what does DDD mean to you? better to use these to guide you to an answer than trusting ai. ai doesn't have any intrinsic understanding of what you're doing, why, or what is "right"; it only knows how to regurgitate the next sentence, which may or may not make sense in the context of what you're doing.
M B V R K
M B V R K5mo ago
I fully agree with you about the AI part, I just want to see how it can answer me The Current projet I'm working on, I just want to use DDD as a challenge