3
Vote

Provide explanatory notes of using Unity Containers in web application and possible pitfalls.

description

As per user suggestion: See discussion thread for further info,ThreadId 27803
 
  1. lifetime managers -- in a web application you would probably prefer your instances are created on a per request (or per web request) basis, however there are times when a singleton would fit. When is the right time to use the singleton vs the per request. Would putting together a per web request (like Windsor) lifetime manager be out of scope?
     
  2. where to use the container -- my understanding is that in a perfect world IoC.Resolve<T> would be called once and only once per application. However, its not a perfect world, so when should we be using the container to resolve dependencies? When is a good time for anything other than your "starting point" to be aware that IoC is even available.
     
    Probably what I have suggested may be more along the lines of best practices and "why" as opposed to a quick start, but I for one would be very thankful for a quick start that answered these questions as opposed to yet another "heres a three page, two component basic blog" example.

comments

rcollette wrote Jun 18, 2009 at 3:57 PM

I agree with item 1. A "Request" or "RequestResponse" lifetime would be useful.

wrote Jun 18, 2009 at 3:57 PM

wrote Apr 28, 2010 at 5:43 AM

wrote Feb 13, 2013 at 10:07 PM