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
I was expecting that AutoRegisterRequestProcessors would register PingPreProcessor and PingPostProcessor, but it does not. I have to register them manually.
I also expected the generic variants to auto-register, but they don't. What does happen, is that the generic preprocessor will register if I manually register PingPreProcessor, and the other way around with the post one. So the manual registration of PingPreProcessor and PingPostProcessor triggers the automatic registration of their generic counterparts.
Is this behavior as expected?
I see no other way to register the generic variants than by closing their type arguments by doing AddRequestPreProcessor<GenericPreProcessor<Ping>>() and AddRequestPostProcessor<GenericPostProcessor<Ping, Pong>>().
Issue #1087 mentions that MediatR will try to register all possible combinations for open generics, which seems to contradict what I'm seeing.
The attached project allows for easy trying out combinations and logs handler/processor activations. Hope that helps.
The text was updated successfully, but these errors were encountered:
I'm quite new to MediatR, so please forgive me if I lack understanding.
I was playing ping-pong using MediatR and encountered some unexpected results. I feel like this might be related to issue #1087.
I've included a project that demonstrates my findings (hopefully not too elaborate):
Registration problems.zip
It consists of these public classes, all in a single assembly:
I was expecting that
AutoRegisterRequestProcessors
would registerPingPreProcessor
andPingPostProcessor
, but it does not. I have to register them manually.I also expected the generic variants to auto-register, but they don't. What does happen, is that the generic preprocessor will register if I manually register
PingPreProcessor
, and the other way around with the post one. So the manual registration ofPingPreProcessor
andPingPostProcessor
triggers the automatic registration of their generic counterparts.Is this behavior as expected?
I see no other way to register the generic variants than by closing their type arguments by doing
AddRequestPreProcessor<GenericPreProcessor<Ping>>()
andAddRequestPostProcessor<GenericPostProcessor<Ping, Pong>>()
.Issue #1087 mentions that MediatR will try to register all possible combinations for open generics, which seems to contradict what I'm seeing.
The attached project allows for easy trying out combinations and logs handler/processor activations. Hope that helps.
The text was updated successfully, but these errors were encountered: