jbogard / ContosoUniversityCore

MIT License
590 stars 150 forks source link

Course Delete.Query & Delete.Command #30

Closed ShaneCourtrille closed 6 years ago

ShaneCourtrille commented 6 years ago

Quick question on why you would have a query for delete and also why the delete command takes in so many parameters? I haven't seen the original Contoso source so is this an artifact of that or is this a personal choice?

cocowalla commented 6 years ago

I'm no @jbogard, but:

The query is used to get details of the Course so they can be displayed in a prompt prior to deletion, whereas the command actually performs the deletion (this is a common pattern with CQRS).

The Delete command isn't really 'taking in' a lot of parameters - it's more that the command is being used as the query result - so the command is the output of the Delete query, and the input to the Delete command.

ShaneCourtrille commented 6 years ago

That makes a lot of sense. Thanks for the insight @cocowalla