Interface IContainerBuilder
Регистратор зависимостей и правил их разрешения.
Namespace:InfinniPlatform.IoC
Assembly:InfinniPlatform.Core.Abstractions.dll
Syntax
public interface IContainerBuilder
Methods
| Improve this Doc View SourceRegisterFactory<TComponent>(Func<IContainerResolver, TComponent>)
Регистрирует фабричный метод компонента.
Declaration
IContainerRegistrationRule RegisterFactory<TComponent>(Func<IContainerResolver, TComponent> componentFactory)where TComponent : class
Parameters
Type | Name | Description |
---|---|---|
Func<IContainerResolver, TComponent> | componentFactory | Фабричный метод компонента. |
Returns
Type | Description |
---|---|
IContainerRegistrationRule | Правила регистрации компонента. |
Type Parameters
Name | Description |
---|---|
TComponent | Тип, реализующий компонент. |
Examples
RegisterFactory(r => new MyComponent())
| Improve this Doc View SourceRegisterGeneric(Type)
Регистрирует компонент по его generic-типу.
Declaration
IContainerRegistrationRule RegisterGeneric(Type componentType)
Parameters
Type | Name | Description |
---|---|---|
Type | componentType | Тип, реализующий компонент. |
Returns
Type | Description |
---|---|
IContainerRegistrationRule | Правила регистрации компонента. |
Remarks
Компонент будет создан с помощью Reflection.
Examples
RegisterGeneric(typeof(MyComponent<>))
| Improve this Doc View SourceRegisterInstance<TComponent>(TComponent)
Регистрирует экземпляр компонента.
Declaration
IContainerRegistrationRule RegisterInstance<TComponent>(TComponent componentInstance)where TComponent : class
Parameters
Type | Name | Description |
---|---|---|
TComponent | componentInstance | Экземпляр компонента. |
Returns
Type | Description |
---|---|
IContainerRegistrationRule | Правила регистрации компонента. |
Type Parameters
Name | Description |
---|---|
TComponent | Тип, реализующий компонент. |
Examples
RegisterInstance(new MyComponent())
| Improve this Doc View SourceRegisterType(Type)
Регистрирует компонент по его типу.
Declaration
IContainerRegistrationRule RegisterType(Type componentType)
Parameters
Type | Name | Description |
---|---|---|
Type | componentType | Тип, реализующий компонент. |
Returns
Type | Description |
---|---|
IContainerRegistrationRule | Правила регистрации компонента. |
Remarks
Компонент будет создан с помощью Reflection.
Examples
RegisterType(typeof(MyComponent))
| Improve this Doc View SourceRegisterType<TComponent>()
Регистрирует компонент по его типу.
Declaration
IContainerRegistrationRule RegisterType<TComponent>()where TComponent : class
Returns
Type | Description |
---|---|
IContainerRegistrationRule | Правила регистрации компонента. |
Type Parameters
Name | Description |
---|---|
TComponent | Тип, реализующий компонент. |
Remarks
Компонент будет создан с помощью Reflection.
Examples
RegisterType<MyComponent>()