ComponentRegistrarSetLifetimeScopeTReflectionActivatorData, TSingleRegistrationStyle Method |
Namespace: Autofac.Configuration.Core
protected virtual void SetLifetimeScope<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 lifetime scope is not part of the recognized grammar. |
By default, this implementation understands the following grammar:
Values | Lifetime Scope |
---|---|
, empty | Default - no specified scope |
single-instance, SingleInstance | Singleton |
instance-per-lifetime-scope, InstancePerLifetimeScope, per-lifetime-scope, PerLifetimeScope | One instance per nested lifetime scope |
instance-per-dependency, InstancePerDependency, per-dependency, PerDependency | One instance for each resolution call |
instance-per-request, InstancePerRequest, per-request, PerRequest | One instance per request lifetime scope |
You may override this method to extend the available grammar for lifetime scope.