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

Nancyfx and MediatR - Where to put the module logic #17

Closed
AlonAm opened this issue Jan 15, 2015 · 1 comment
Closed

Nancyfx and MediatR - Where to put the module logic #17

AlonAm opened this issue Jan 15, 2015 · 1 comment

Comments

@AlonAm
Copy link

AlonAm commented Jan 15, 2015

Hi
I'm using Nancyfx and MediatR
In my nancy module (a cousin of mvc controller)
There's some logic done by the Module itself
for example input-model-validation, response object manipulation, LoginAndRedirect, etc.
these are extensions of the nancy Module object

Common usage example: https://github.com/NancyFx/DinnerParty/blob/master/src/Modules/AccountModule.cs

Is it a good practice to move that logic into the Request Handler which will return a nancy Response object?

thanks allot :-)

@jbogard
Copy link
Owner

jbogard commented Jan 15, 2015

Is this what a normal Nancy module looks like? There's a lot of different concerns going on in one POST operation.

I tend to have my "request handler" in MVC applications be more or less a domain concern. The input is the bound form object, and the output is some result. Something like "ApproveInvoice -> Invoice" and you could then take that result and redirect appropriately.

For the other ancillary concerns, I either use filters, or a mediator pipeline that I create as a decorator around all my handler.

@AlonAm AlonAm closed this as completed Jan 18, 2015
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