다음을 통해 공유


Creating Lifetime Managers

Unity supports several approaches for registering classes, interfaces, and instances of existing objects. You can use the RegisterType and RegisterInstance methods to register object instances at run time, or specify the mappings and registrations at design time in configuration. You can also specify a lifetime manager with all of these approaches that will control how Unity resolves instances of the specified types and how it holds references to these instances. The built-in lifetime managers allow you to specify objects as singletons, with weak references, or as per-thread instances. For more details, see Understanding Lifetime Managers.

You can create custom LifetimeManager classes if you require additional functionality not available in the default lifetime managers. Documentation to help you do this is available from the Unity Community Web site on CodePlex.