You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This really isn't specific to MediatR but more about the pattern in general.
In a warehouse domain, lets say I want to update the stock of a product. I have these handlers listening for a StockUpdated command event:
UpdateStockCount (updates the qty of stock on hand, db) SendNotificationEmail (sends email to manager) UpdateProductStatus (updates the product status, Out of stock, need ordering etc etc)
Now lets say I DO NOT want to send and email to the manager if the stock change is < 10 in SendNotificationEmail and I need to inform the user of this. How/Where should this validation take place? Command handlers dont return anything, so I assume not there. Should SendNotificationEmail be a query handler instead, with a separate query request?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This really isn't specific to MediatR but more about the pattern in general.
In a warehouse domain, lets say I want to update the stock of a product. I have these handlers listening for a
StockUpdated
command event:UpdateStockCount
(updates the qty of stock on hand, db)SendNotificationEmail
(sends email to manager)UpdateProductStatus
(updates the product status, Out of stock, need ordering etc etc)Now lets say I DO NOT want to send and email to the manager if the stock change is < 10 in
SendNotificationEmail
and I need to inform the user of this. How/Where should this validation take place? Command handlers dont return anything, so I assume not there. Should SendNotificationEmail be a query handler instead, with a separate query request?Beta Was this translation helpful? Give feedback.
All reactions