- add iRegistrationBase info and iDefaultRegistration

master
Simon Gockner 6 years ago
parent 4b55aa8693
commit 0c8fffb8dc
  1. 3
      Home.md
  2. 48
      IRegistrationBase.md

@ -27,6 +27,9 @@ Welcome to the Lightweight IOC Container wiki!
- [Base interface](IIocInstaller#base-interface)
- [`AssemblyInstaller`](IIocInstaller#assemblyInstaller)
- [`IRegistrationBase`](IRegistrationBase)
- [`IDefaultRegistration<TInterface>`](IRegistrationBase#IDefaultRegistrationTInterface)
- [`IMultitonRegistration<TInterface>`](IRegistrationBase#IMultitonRegistrationTInterface)
- [`ITypedFactoryRegistration<TFactory>`](IRegistrationBase#ITypedFactoryRegistrationTFactory)
- [Lifestyles](Lifestyles)
- [`Lifestyle.Transient`](Lifestyles#lifestyletransient)
- [`Lifestyle.Singleton`](Lifestyles#lifestylesingleton)

@ -1,7 +1,53 @@
The `IRegistrationBase` is an interface that is used to register an interface with the `IocContainer`.
The `IRegistrationBase` is a base interface for all registration classes that are used to register interfaces with the `IocContainer`.
It consists only of two properties:
```c#
/// <summary>
/// The name of the <see cref="IRegistrationBase"/>
/// </summary>
string Name { get; }
```
and
```c#
/// <summary>
/// The <see cref="Type"/> of the Interface that is registered with this <see cref="IRegistrationBase"/>
/// </summary>
Type InterfaceType { get; }
```
## `IDefaultRegistration<TInterface>`
This is the default registration that is used to register a `Type` for the interface it implements. `TInterface` is the `Type` of the interface.
In addition to the implemented properties from the `IRegistrationBase` the `IDefaultRegistration` adds the following properties and methods:
- The Type that implements the `IRegistrationBase.InterfaceType` that gets registered
```c#
Type ImplementationType { get; }
```
- The `Lifestyle` of the registered `Type`
```c#
Lifestyle Lifestyle { get; }
```
- An `Action` that is invoked when an instance of the registered type is created
```c#
Action<TInterface> OnCreateAction { get; }
```
- A method to pass the `OnCreateAction` to the `IDefaultRegistration`
```c#
IDefaultRegistration<TInterface> OnCreate(Action<TInterface> action);
```
## `IMultitonRegistration<TInterface>`
## `ITypedFactoryRegistration<TFactory>`

Loading…
Cancel
Save