ComponentRegistrarSetComponentOwnershipTReflectionActivatorData, TSingleRegistrationStyle Method |
Namespace: Autofac.Configuration.Core
protected virtual void SetComponentOwnership<TReflectionActivatorData, TSingleRegistrationStyle>( IConfiguration component, IRegistrationBuilder<Object, TReflectionActivatorData, TSingleRegistrationStyle> registrar ) where TReflectionActivatorData : ReflectionActivatorData where TSingleRegistrationStyle : SingleRegistrationStyle
| Exception | Condition |
|---|---|
| ArgumentNullException | Thrown if registrar or component is . |
| InvalidOperationException | Thrown if the value for ownership is not part of the recognized grammar. |
By default, this implementation understands or empty values to be "default ownership model"; lifetime-scope or LifetimeScope is "owned by lifetime scope"; and external or ExternallyOwned is externally owned.
By default, this implementation understands the following grammar:
| Values | Lifetime Scope |
|---|---|
| , empty | Default - no specified ownership model |
| lifetime-scope, LifetimeScope | Owned by lifetime scope |
| external, ExternallyOwned | Externally owned |
You may override this method to extend the available grammar for component ownership.