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 ActionResult invoker #10

Closed
danieltian opened this issue Nov 3, 2010 · 3 comments
Closed

Add ActionResult invoker #10

danieltian opened this issue Nov 3, 2010 · 3 comments

Comments

@danieltian
Copy link

I noticed that Ninject.Web.Mvc has an ActionFilter invoker, to inject dependencies into an ActionFilter. Is it possible to do the same for ActionResults?

@remogloor
Copy link
Member

As ActionResults are created in Actions of a controller you have to inject a IKernel(or better IResolutionRoot) into your controller (or better a result factory that is inected to the controller) and let the kernel create the desired action result.

Or do you mean IResultFilter? They are injected too.

@danieltian
Copy link
Author

I want to be able to inject some custom ActionResults for my application. The current problem I'm dealing with is detailed here:

http://stackoverflow.com/questions/4083352/how-do-i-use-ninject-with-actionresults-while-making-the-controller-ioc-framework

I did find this post that illustrates how to do it:

http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/12/12/enabling-ioc-in-asp-net-actionresults-or-a-better-actionresult.aspx

But unfortunately, it's written for StructureMap and I don't know enough about Ninject to be able to add it to Ninject.Web.Mvc.

@remogloor
Copy link
Member

Answered on stackoverflow

This issue was closed.
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