Support for polymorphic send/publish? #1612
Unanswered
sreejith-ms
asked this question in
Q&A
Replies: 1 comment 2 replies
-
So if you do: await _commandProcessor.Publish((dynamic)domainEvent); This should work as expected. That is what we use most places. I note that you say you are against that. I guess your concern is that it's not a 'pit of success' for folks, who have to know this workaround on generic collections. We don't have an alternative now, although we could look at this question again if it is enough of a problem. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My requirements are very similar to #116 and #144.
I'm trying to switch from MediatR to Brighter. I have a wrapper class (
CommandHandlerBase
), used for the command handler delegation to MediatR. The command handlers in the application use the wrapper class (so it is easy to switch to another library). Also, there are base classes used for commands and domain events.The commands and events are using this base class/interface to send/publish. Brighter throws an exception as
No command handler was found for the typeof command paramore.brighter.commandprocessor.ICommand - a command should have exactly one handler
Examples:
Found 0 async pipelines for event: HelloAsyncListeners.GreetingEvent
The domain events are stored in the entity, similar to: https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs#L23
and the events are published before committing https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs#L63
I think Brighter uses generics to resolve the type from the registry, but Mediator uses the type to resolve.
https://github.com/BrighterCommand/Brighter/blob/master/src/Paramore.Brighter/Interpreter.cs#L61
https://github.com/jbogard/MediatR/blob/master/src/MediatR/Mediator.cs#L36
Any thoughts/workaround on this? apart from the nasty
(dynamic)command
casting.Beta Was this translation helpful? Give feedback.
All reactions