I need good example for Unity 2.0 & ASP.Net Website

Jun 6, 2010 at 10:12 PM
Edited Jun 6, 2010 at 10:15 PM
Hello, I download the current Unity C# example in this web page. The Unity example uses in Unity 1.0 for ASP.NET C#. I cannot uses these examples for Unity 2.0 library because the APIs has changed. Can someone update the Unity 2.0 example for the ASP.NET? I am new at Unity library. It is really help if someone take time to write some good examples that shown some DI examples for existing ASP.NET and ASP.NET MVC project. I see the support for technical articles are limit. Thank You Mike
Jun 6, 2010 at 10:41 PM
Se my blog post here: http://www.rickardnilsson.net/post/2010/06/06/ASPNET-MVC-2-Framework-and-Unity-2-Dependency-Injection-Container.aspx
Jun 7, 2010 at 12:19 PM


The web link to your blog is broken. I cannot see it. Microsoft should write some good examples to their library in order to support new developers.


Jun 7, 2010 at 2:18 PM

Hi Mike! Sorry, I forgot to check the Publish-checkbox. My bad. Please check it now. 

I totally agree, Microsoft need to produce more documentation but I guess they rely on community content for the time being.

// Rickard

Jun 7, 2010 at 3:37 PM

What page is the demo code you're talking about on? Is it one of ours or a blog post somewhere?


Jun 7, 2010 at 3:52 PM
Rickard, Thank You for publish the blog. I am also looking for Unity 2.0 for ASP.NET solution. I have an ASP.NET solution. We would to integerate Unity 2.0 into existing ASP.net project, can you write a blog to help me to get it working. Thank You Mike
Jun 7, 2010 at 3:55 PM
Hi; The code demo in Unity/CodePlex is quite old. It is using Unity 1.0 library, while Microsoft put out Unity 2.0 library. Some APIs has changed. Here is old Unity 1.0 examples in codeplex. Old Unity 1.0 library examples: http://unity.codeplex.com/wikipage?title=Code%20samples&referringTitle=Home Mike
Jun 7, 2010 at 8:09 PM
@mikemdd: regarding a sample on Unity and ASP.NET, while it targets the 1.0 versions it is still valid. Check out David Heyden's screen cast http://www.pnpguidance.net/Screencast/UnityIoCASPNETScreencastDependencyInjectionWebPages.aspx // Rickard
Jun 10, 2010 at 3:46 PM

Hi Rickard;

Thank you for good webcast of the Unity and ASP.net inside PngGuidance.net. This help me quite a bit. I am now putting DI into my existing web solution.

Thank You