Category Archives: Dependency Injection/Inversion of Control

Resolving Instances using Delegates in Unity

Introduction In previous posts, I have covered bootstrapping Unity in MVC, using Unity as a DependencyResolver in MVC and using Unity in conjunction with WCF services. I am going to extend the Unity theme a little bit more and describe … Continue reading

Posted in StructureMap, Unity | Tagged , , | 1 Comment

WCFContext and Inversion of Control in WCF with Unity and ServiceLocator

Introduction In previous posts here and here, I have covered configuring Unity for ASP.net MVC. I am going to build upon those posts and cover configuring Unity as an Inversion of Control (IOC) container for WCF, so that patterns such … Continue reading

Posted in ASP.Net MVC, Dependency Injection/Inversion of Control, Design Patterns, Unity, WCF | Tagged , , , , | 1 Comment

IOC Containers, HttpContext Managed Lifecycle and Disposable Objects

I like to use an IOC container to resolve web services in my controllers. I also like the IOC container to manage the lifetime of those services, so that my controllers are not fussed about having to dispose of things … Continue reading

Posted in ASP.Net MVC, StructureMap, Unity | Leave a comment

IDependencyResolver and Global Action Filters in ASP.Net MVC 3

Following on my previous posts regarding IDependencyResolver and Bootstrapping Unity, I realise that there is a fairly elegant solution to injecting global action filters at runtime. Multiple ActionFilters can be registered with Unity as follows: Then it is simply a … Continue reading

Posted in ASP.Net MVC, Dependency Injection/Inversion of Control | Tagged , , , , | Leave a comment

Bootstrapping Unity 2.0

Unity 2.0 features a nice(r) fluent configuration – similar to StructureMap. These run time configuration and registration methods are great, but they have a draw back in that they need to be bootstrapped differently according to the runtime environment. For … Continue reading

Posted in Dependency Injection/Inversion of Control, Unity | Tagged , , , | 2 Comments

Using Unity as a Dependency Resolver – ASP.Net MVC 3

**Update if you are using unity, you might want to check out my ideas on bootstrapping it in ASP.net MVC.** ASP.Net MVC 3 has developed the concept of a Dependency Resolver to provide IOC/DI support. This is analogous to the … Continue reading

Posted in ASP.Net MVC, Dependency Injection/Inversion of Control, Unity | Tagged , , | 6 Comments