-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MissingMessageHandlerException when passing derived class to Send #100
Comments
Mmm.. I don't think that's the problem. First because records are classes (unless it's a struct record). Second, because I'm already using records as commands and it works just fine. |
I believe feiyun0112 is correct, but it would be nice to support interfaces or abstract classes |
Even if the source generator filters out the interface itself (like @feiyun0112 says), it still is able to find the concrete requests deriving from I guess the practical difference in the end would be public sealed class MyReqHandler : IRequestHandler<IMyReq, string>
{
public ValueTask<string> Handle(IMyReq req, CancellationToken ct)
{
switch (req)
{
// ...
}
}
} vs public sealed class ConcreteReq1Handler : IRequestHandler<ConcreteReq1, string>
{
public ValueTask<string> Handle(ConcreteReq1 req, CancellationToken ct)
{ }
}
public sealed class ConcreteReq2Handler : IRequestHandler<ConcreteReq2, string>
{
public ValueTask<string> Handle(ConcreteReq2 req, CancellationToken ct)
{ }
} So I think the implementation and maintenance cost outweigh the benefit in this case |
I understand why this doesn't work, but would it be possible to implement support for this?
This is my use-case:
In domain project (with Mediator.Abstractions)
In asp.net application project (with Mediator.SourceGenerator)
The text was updated successfully, but these errors were encountered: