Interface IRegister
Defines a service register for Umbraco.
Namespace: Umbraco.Core.Composing
Assembly: Umbraco.Core.dll
Syntax
public interface IRegister
Properties
View SourceConcrete
Gets the concrete container.
Declaration
object Concrete { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
View SourceConfigureForWeb()
Configures the container for web support.
Declaration
void ConfigureForWeb()
Remarks
Enables support for MVC, WebAPI, but not per-request scope. This is used early in the boot process, where anything "scoped" should not be linked to a web request.
CreateFactory()
Creates the factory.
Declaration
IFactory CreateFactory()
Returns
Type | Description |
---|---|
IFactory |
Register(Type, Object)
Registers a service with an implementing instance.
Declaration
void Register(Type serviceType, object instance)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | |
System.Object | instance |
Register(Type, Type, Lifetime)
Registers a service with an implementation type.
Declaration
void Register(Type serviceType, Type implementingType, Lifetime lifetime = Lifetime.Transient)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | |
System.Type | implementingType | |
Lifetime | lifetime |
Register(Type, Lifetime)
Registers a service as its own implementation.
Declaration
void Register(Type serviceType, Lifetime lifetime = Lifetime.Transient)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | |
Lifetime | lifetime |
Register<TService>(Func<IFactory, TService>, Lifetime)
Registers a service with an implementation factory.
Declaration
void Register<TService>(Func<IFactory, TService> factory, Lifetime lifetime = Lifetime.Transient)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<IFactory, TService> | factory | |
Lifetime | lifetime |
Type Parameters
Name | Description |
---|---|
TService |
RegisterAuto(Type)
Registers a base type for auto-registration.
Declaration
void RegisterAuto(Type serviceBaseType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceBaseType |
Remarks
Auto-registration means that anytime the container is asked to create an instance
of a type deriving from serviceBaseType
, it will first register that
type automatically.
This can be used for instance for views or controllers. Then, one just needs to register a common base class or interface, and the container knows how to create instances.
RegisterFor<TService, TTarget>(TService)
Registers a service for a target, with an implementing instance.
Declaration
void RegisterFor<TService, TTarget>(TService instance)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
TService | instance |
Type Parameters
Name | Description |
---|---|
TService | |
TTarget |
Remarks
There can only be one implementation or instanced registered for a service and target; what happens if many are registered is not specified.
RegisterFor<TService, TTarget>(Func<IFactory, TService>, Lifetime)
Registers a service for a target, with an implementation factory.
Declaration
void RegisterFor<TService, TTarget>(Func<IFactory, TService> factory, Lifetime lifetime = Lifetime.Transient)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Func<IFactory, TService> | factory | |
Lifetime | lifetime |
Type Parameters
Name | Description |
---|---|
TService | |
TTarget |
Remarks
There can only be one implementation or instanced registered for a service and target; what happens if many are registered is not specified.
RegisterFor<TService, TTarget>(Type, Lifetime)
Registers a service for a target, with an implementation type.
Declaration
void RegisterFor<TService, TTarget>(Type implementingType, Lifetime lifetime = Lifetime.Transient)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.Type | implementingType | |
Lifetime | lifetime |
Type Parameters
Name | Description |
---|---|
TService | |
TTarget |
Remarks
There can only be one implementation or instanced registered for a service and target; what happens if many are registered is not specified.
RegisterFor<TService, TTarget>(Lifetime)
Registers a service for a target, as its own implementation.
Declaration
void RegisterFor<TService, TTarget>(Lifetime lifetime = Lifetime.Transient)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
Lifetime | lifetime |
Type Parameters
Name | Description |
---|---|
TService | |
TTarget |
Remarks
There can only be one implementation or instanced registered for a service and target; what happens if many are registered is not specified.