Why do we need explisitt lifetime managment?

Feb 25, 2008 at 8:13 AM
Edited Feb 25, 2008 at 8:14 AM
This my sound like a dumb question, but wouldnt it be nice not to worry about lifetime managment when you operate on the Unity Container?

When we register a class, this tells us that everytime you ask for one, it will be a new instance you get.
When we register an instance for a class, the instance registered will be returned everytime you ask for a class.

Lets say you register by configuration eiter types or instances. Instances should then be singeltons and types should not be.

The reason I think this is a dumb question, is that I can't this stuff good enough, but try to learn.

I would like to have a simpel Unity Container without all the fuzz.
Feb 25, 2008 at 5:00 PM
If you don't do anything special, you get exactly the behavior you describe.

The issue is, in many cases, due to web apps. They often need to have instances available on a per-request or per-session basis. Once you support that, it's a very short step to general lifetime management.

Without this feature the WCSF wouldn't be able to use Unity and Blaine would be very upset with me. I really don't want that. ;-)
Feb 25, 2008 at 8:05 PM
This I can grasp. I hope to get to use the new WCSF in one of my projects.

But when I'm on the roll here (being dumb).

Are we using lifetimemanagment on the containers them self, or are we focusing on the objects ?