UnityTypeElement.Lifetime Property
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Unity Application Block information can be found at the Unity Application Block site. |
Sets the lifetime for the given type and name. Transient means to create a new instance every type and is the default. Singleton means to return the same instance on every request.
Namespace: Microsoft.Practices.Unity.Configuration
Assembly: Microsoft.Practices.Unity.Configuration (in Microsoft.Practices.Unity.Configuration.dll)
Syntax
'Declaration
<ConfigurationPropertyAttribute("lifetime", IsRequired := False)> _
Public Property Lifetime As UnityLifetimeElement
[ConfigurationPropertyAttribute("lifetime", IsRequired = false)]
public UnityLifetimeElement Lifetime { get; set; }
[ConfigurationPropertyAttribute(L"lifetime", IsRequired = false)]
public:
property UnityLifetimeElement^ Lifetime {
UnityLifetimeElement^ get ();
void set (UnityLifetimeElement^ value);
}
public function get Lifetime () : UnityLifetimeElement
public function set Lifetime (value : UnityLifetimeElement)
Remarks
When configuring a singleton, if both the type and mapTo attributes are specified, the SetSingleton call will be done on the type specified in the mapTo attribute. Otherwise it'll be done on the type specified in the Type attribute.