Based on several requests, I created a new screencast that shows one step-by-step how to add the Unity IoC Container from Microsoft Patterns & Practices to an ASP.NET MVC Web Application to create controllers and inject their dependencies.
Unity IoC – Dependency Injection in ASP.NET MVC Framework Screencast
You can also catch the first Unity Screencast that shows about a dozen common usages of Unity as well as briefly discusses the use of Unity using MVC and Model-View-Presenter:
Unity Dependency Injection IoC Screencast
Here are some links to sample code on Unity regarding what you see in the screencasts:
- Unity IoC and ASP.NET MVC Framework – Dependency Injection of Controllers
- Unity Nested Containers – IUnityParentContainer and CreateChildContainer
- UnityContainer and UnityConfigurationSection – Populating Unity Container via App.config or Web.config
- Unity IoC Dependency Injection and ASP.NET Model-View-Presenter
Hope this helps.
Dave
We’ll get there. I’ve got to get Entlib 4 out the door next.
Also, you should update your tutorials. IUnityParentContainer went away a couple of drops ago; CreateChildContainer is now available directly off IUnityContainer.
@Chris,
Good to know. I didn’t realize that. I’m waiting for your webcast so I can pick up even more pointers, especially on extensibility
One minor nit at the beginning: If you install the block with the MSI, the Unity assemblies are available on the .NET tab. You don’t need to browse for them.
-Chris
Nice cast, I prefer castle windsor. It is good that the ASP.NET MVC framework is not dependent on any one IoC container.
Hey great job on the screen cast. Pretty slick use there for the dependency injection and ControllerFactory. Can’t wait to start using these items in my daily programming life.