0

I have an asp.net application and have used MVP pattern and created interfaces for all classes to make them testable and apply dependency injection.

I am going to use an IoC container, perhaps Microsoft Unity, to inject the dependencies in a single place.

I've used Spring.NET for a Windows Service application before but for ASP.NET it would be different as we have requests and responses and application life cycle so not sure how to set up it.

Is there any good sample application to demonstrate how to setup and configure an IoC container with ASP.NET?

Many thanks,

The Light
  • 26,341
  • 62
  • 176
  • 258

2 Answers2

2

If you are looking for a good IOC container - check out http://ninject.org/

There is a decent MVP example on codeplex using Ninject - http://webformsmvpcontrib.codeplex.com/wikipage?title=Ninject

And here is a good example on Stackoverflow using Ninject and the MVP pattern - ASP.NET MVP Injecting Service Dependency

Community
  • 1
  • 1
Deano
  • 2,805
  • 3
  • 29
  • 42
  • thanks; very good. why would you recommend Ninject though? have you tried other IoC tools? Ninject is the slowest according to http://www.iocbattle.com/ – The Light Jul 26 '11 at 08:44
  • Well, I guess Im just familiar with it and it's quite easy to get it up and running. Dont get me wrong there are loads of great IOC tools out there. I also ran a small poll on my site to get what devs favourite IOC conatiners are - check it out - http://deanhume.com/Home/BlogPost/vote-for-your-favourite--net-di--ioc--framework/9 – Deano Jul 26 '11 at 10:35
  • btw, your link has no download: http://webformsmvpcontrib.codeplex.com/wikipage?title=Ninject – The Light Jul 26 '11 at 20:50
  • yeah but it only has some class libraries, no asp.net application. – The Light Jul 28 '11 at 08:40
0

Windsor has always been my favorite and stackoverflow is the best source

Community
  • 1
  • 1
Illuminati
  • 4,539
  • 2
  • 35
  • 55