Build Singleton under Unity

May 13, 2008 at 4:57 PM
Hi all

If I build a singleton under the unity? Is it necessary that we build it with a "REAL" singleton pattern static class? Or it is fine that we just build a normal class and tell the Unity that we are going to make it as singleton?

Regards
Alex
May 13, 2008 at 8:34 PM
Typically, it's fine to just use ContainerControlledLifetimeManager to build objects that last as long as the container does.

If you need an object that is a singleton even when you don't get it from the container, then you need a "real" singleton class.