ardalis / CleanArchitecture

Clean Architecture Solution Template: A starting point for Clean Architecture with ASP.NET Core
MIT License
15.24k stars 2.67k forks source link

Why is the implementation of the DeleteContributorService in the core layer? #677

Closed ParsaMehdipour closed 5 months ago

ParsaMehdipour commented 5 months ago
ardalis commented 5 months ago

Two reasons: 1) So I could have an example of a domain service 2) So I could show sending a domain event from a domain service

If there weren't the domain event it could easily have just been in the UseCases folder as a DeleteCommandHandler doing everything. And if you wanted to fire off domain events there, you could, but my preference is to keep them in the domain (as their name implies).

ParsaMehdipour commented 5 months ago

Thank you for your insightful response. I now comprehend the preferred approach as highlighted in the comments, emphasizing the maintenance of domain service logics in the core layer.