Click or drag to resize

ComponentRegistrarSetComponentOwnershipTReflectionActivatorData, TSingleRegistrationStyle Method

Sets the ownership model for the component.

Namespace:  Autofac.Configuration.Core
Assembly:  Autofac.Configuration (in Autofac.Configuration.dll) Version: 6.0.0+ec1c6438ceb3f3338c7364e35e7303f014e3fc39
Syntax
protected virtual void SetComponentOwnership<TReflectionActivatorData, TSingleRegistrationStyle>(
	IConfiguration component,
	IRegistrationBuilder<Object, TReflectionActivatorData, TSingleRegistrationStyle> registrar
)
where TReflectionActivatorData : ReflectionActivatorData
where TSingleRegistrationStyle : SingleRegistrationStyle

Parameters

component
Type: IConfiguration
The configuration data containing the component. The ownership content will be read from this configuration object and used to determine component ownership.
registrar
Type: Autofac.BuilderIRegistrationBuilderObject, TReflectionActivatorData, TSingleRegistrationStyle
The component registration on which component ownership is being set.

Type Parameters

TReflectionActivatorData
Activator data type.
TSingleRegistrationStyle
Registration style.
Exceptions
ExceptionCondition
ArgumentNullException Thrown if registrar or component is .
InvalidOperationException Thrown if the value for ownership is not part of the recognized grammar.
Remarks

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:

ValuesLifetime Scope
, emptyDefault - no specified ownership model
lifetime-scope, LifetimeScopeOwned by lifetime scope
external, ExternallyOwnedExternally owned

You may override this method to extend the available grammar for component ownership.

See Also