Skip to content
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

Add support for generic variance for post request handler. #1

Closed
marisks opened this issue May 31, 2014 · 5 comments
Closed

Add support for generic variance for post request handler. #1

marisks opened this issue May 31, 2014 · 5 comments

Comments

@marisks
Copy link

marisks commented May 31, 2014

The use case for it is when after command executed to commit changes to DB.

I am using RavenDB and I'd like to have generic post request handler which will call SaveChanges on document session.

@jbogard
Copy link
Owner

jbogard commented Jun 2, 2014

@marisks
Copy link
Author

marisks commented Jun 2, 2014

The thing is that Mediator's GetPostRequestHandlers method returns handlers only with specific response type.

https://github.com/jbogard/MediatR/blob/master/src/MediatR/Mediator.cs#L97

It would work fine if there would be only one response type for all requests, but if requests have different responses, then have to make post request handler for each response type.

@jbogard
Copy link
Owner

jbogard commented Jun 2, 2014

Do you have an example of a request/response with a post handler that isn't
currently firing appropriately?

On Mon, Jun 2, 2014 at 8:52 AM, Māris Krivtežs notifications@github.com
wrote:

The thing is that Mediator's GetPostRequestHandlers method returns
handlers only with specific response type.

https://github.com/jbogard/MediatR/blob/master/src/MediatR/Mediator.cs#L97

It would work fine if there would be only one response type for all
requests, but if requests have different responses, then have to make post
request handler for each response type.


Reply to this email directly or view it on GitHub
#1 (comment).

@marisks
Copy link
Author

marisks commented Jun 2, 2014

Created sample:
https://github.com/marisks/mediatr-sample

Seems that notification handler is not firing too. I am using StructureMap as IoC and maybe haven't configured it properly:

https://github.com/marisks/mediatr-sample/blob/master/mediatr-sample/Bootstrap.cs#L17

@marisks
Copy link
Author

marisks commented Jun 2, 2014

Seems that generic versions has to be registered explicitly:
https://github.com/jbogard/MediatR/blob/master/src/MediatR.Examples.StructureMap/Program.cs#L35

Haven't seen that sample before.

Thanks for help and great library!

@marisks marisks closed this as completed Jun 2, 2014
jbogard pushed a commit that referenced this issue Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants