SaaS CMS has officially launched! Learn more now.

Class ConfiguredType<T>

Represents a typed configured service

Inheritance
System.Object
ConfiguredType<T>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.ServiceLocation.Compatibility
Assembly: EPiServer.Framework.dll
Version: 10.10.4
Syntax
public abstract class ConfiguredType<T>
Type Parameters
Name Description
T

The service type

Constructors

ConfiguredType()

Declaration
protected ConfiguredType()

Methods

Add<T1>()

Adds a implementation type for the service type

Declaration
public abstract void Add<T1>()
    where T1 : T
Type Parameters
Name Description
T1

The implementation type

AlwaysUnique()

Specifies that the service should be transient

Declaration
public abstract ConfiguredType<T> AlwaysUnique()
Returns
Type Description
ConfiguredType<T>

The configured service

HybridHttpOrThreadLocalScoped()

Specifies that the service should have hybrid (http context or thread local) lifecycle

Declaration
public abstract ConfiguredType<T> HybridHttpOrThreadLocalScoped()
Returns
Type Description
ConfiguredType<T>

The configured service

LifecycleIs(ServiceInstanceScope)

Specifies which lifecyscle the service should have

Declaration
public abstract ConfiguredType<T> LifecycleIs(ServiceInstanceScope lifecycle)
Parameters
Type Name Description
ServiceInstanceScope lifecycle

The lifecycle to set

Returns
Type Description
ConfiguredType<T>

The configured service

Singleton()

Specifies that the service should be singleton

Declaration
public abstract ConfiguredType<T> Singleton()
Returns
Type Description
ConfiguredType<T>

The configured service

Transient()

Specifies that the service should be transient

Declaration
public abstract ConfiguredType<T> Transient()
Returns
Type Description
ConfiguredType<T>

The configured service

Use(Expression<Func<T>>)

Registers a factory for the instance.

Declaration
public abstract void Use(Expression<Func<T>> instanceAccessor)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<T>> instanceAccessor

The instance factory

Use<K>()

Registers a concrete type for the service.

Declaration
public abstract void Use<K>()
    where K : T
Type Parameters
Name Description
K

The implementation type

Use<TInstance>(TInstance)

Registers a instance for the service type..

Declaration
public abstract void Use<TInstance>(TInstance instance)
    where TInstance : class, T
Parameters
Type Name Description
TInstance instance

The instance

Type Parameters
Name Description
TInstance

The instance type

Use<TInstance>(Func<IServiceLocator, TInstance>)

Registers a factory for the instance.

Declaration
public abstract void Use<TInstance>(Func<IServiceLocator, TInstance> instanceAccessor)
    where TInstance : class, T
Parameters
Type Name Description
System.Func<IServiceLocator, TInstance> instanceAccessor

The instance factory

Type Parameters
Name Description
TInstance

The instance type

Extension Methods