martinothamar / Mediator

A high performance implementation of Mediator pattern in .NET using source generators.
MIT License
2.16k stars 71 forks source link

Empty Handler needed in order to work with behavoiur pipeline #129

Closed CrahunGit closed 8 months ago

CrahunGit commented 1 year ago

I've tried replacing a three steps behaviour but I've found an exception saying that for this request there was no handler registered. So I've created an empty handler in order to work.

My Request Object implements now IRquest and I message.

Seems a bug since Mediatr works fine without it.

martinothamar commented 11 months ago

Hi! Could you elaborate, or do you have som example code?

All requests (not notifications) need a handler. There should be an analyzer warning/error if a handler isn't defined, is that what you are seeing? I think this is good behavior as it pushes the error to the buildtime instead of runtime, for example if the handler wasn't implemented by mistake.

You are also not meant to directly implement IMessage if that's what you're saying, it's only a marker type to support multiple types of requests. I could probably add a diagnostic for that.

martinothamar commented 8 months ago

Closing this, let me know if you find time to provide more info