Using Dependency Injection Using Http Handlers

I am using ASP.NET MVC 2 with Ninject and Linq2SQL behind a repository template based on Rob Conery TekPub Starter Site .

Everything works fine with controllers, but I have an HTTP handler (it serves and resizes images from the database), and I have no idea how I use Ninject to replace the ISession interface with a specific instance of my LinqToSQLSession.

How am I best to do this?

+3
source share
2 answers

Use injection properties. I used it with StructureMap, but Ninject should support it

HTTP DI.

Update:

, : http://wiki.github.com/ninject/ninject/injection-patterns

Iinern ninject .Inject(this) .

+1

SO ninject w/HttpHandlers: HttpHandler Injection Ninject, null

, , , , , . !

+1

Source: https://habr.com/ru/post/1766508/


All Articles