- Refactoring, prepare for #29:

- rename IRegistrationBase to IRegistration
    - split IDefaultRegistraton into IRegistrationBase and a new IDefaultRegistration (same with implementations)
pull/32/head
Simon Gockner 6 years ago
parent d4f5b8eeb5
commit 62627ca923
  1. 4
      LightweightIocContainer/Exceptions/UnknownRegistrationException.cs
  2. 20
      LightweightIocContainer/Interfaces/IIocContainer.cs
  3. 2
      LightweightIocContainer/Interfaces/Installers/IIocInstaller.cs
  4. 31
      LightweightIocContainer/Interfaces/Registrations/IDefaultRegistration.cs
  5. 24
      LightweightIocContainer/Interfaces/Registrations/IRegistration.cs
  6. 22
      LightweightIocContainer/Interfaces/Registrations/IRegistrationBase.cs
  7. 2
      LightweightIocContainer/Interfaces/Registrations/ITypedFactoryRegistration.cs
  8. 4
      LightweightIocContainer/Interfaces/Registrations/IUnitTestCallbackRegistration.cs
  9. 36
      LightweightIocContainer/IocContainer.cs
  10. 2
      LightweightIocContainer/Lifestyle.cs
  11. 193
      LightweightIocContainer/LightweightIocContainer.xml
  12. 59
      LightweightIocContainer/Registrations/DefaultRegistration.cs
  13. 62
      LightweightIocContainer/Registrations/RegistrationBase.cs
  14. 14
      LightweightIocContainer/Registrations/RegistrationFactory.cs
  15. 4
      LightweightIocContainer/Registrations/UnitTestCallbackRegistration.cs
  16. 4
      Test.LightweightIocContainer/AssemblyInstallerTest.cs
  17. 4
      Test.LightweightIocContainer/RegistrationBaseTest.cs

@ -8,12 +8,12 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// An unknown <see cref="IRegistrationBase"/> was used
/// An unknown <see cref="IRegistration"/> was used
/// </summary>
internal class UnknownRegistrationException : Exception
{
/// <summary>
/// An unknown <see cref="IRegistrationBase"/> was used
/// An unknown <see cref="IRegistration"/> was used
/// </summary>
/// <param name="message">The exception message</param>
public UnknownRegistrationException(string message)

@ -10,7 +10,7 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Interfaces
{
/// <summary>
/// The main container that carries all the <see cref="IRegistrationBase"/>s and can resolve all the types you'll ever want
/// The main container that carries all the <see cref="IRegistration"/>s and can resolve all the types you'll ever want
/// </summary>
public interface IIocContainer : IDisposable
{
@ -26,17 +26,17 @@ namespace LightweightIocContainer.Interfaces
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface;
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistration"/></returns>
IRegistrationBase<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface;
/// <summary>
/// Register a <see cref="Type"/> without an interface
/// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient);
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistration"/></returns>
IRegistrationBase<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient);
/// <summary>
/// Register an Interface with a Type that implements it as a multiton
@ -44,14 +44,14 @@ namespace LightweightIocContainer.Interfaces
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <typeparam name="TScope">The Type of the multiton scope</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
IMultitonRegistration<TInterface> Register<TInterface, TImplementation, TScope>() where TImplementation : TInterface;
/// <summary>
/// Register an Interface as an abstract typed factory
/// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
ITypedFactoryRegistration<TFactory> RegisterFactory<TFactory>();
/// <summary>
@ -59,7 +59,7 @@ namespace LightweightIocContainer.Interfaces
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <param name="unitTestCallback">The <see cref="ResolveCallback{T}"/> for the callback</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
IUnitTestCallbackRegistration<TInterface> RegisterUnitTestCallback<TInterface>(ResolveCallback<TInterface> unitTestCallback);
/// <summary>

@ -12,7 +12,7 @@ namespace LightweightIocContainer.Interfaces.Installers
public interface IIocInstaller
{
/// <summary>
/// Install the needed <see cref="IRegistrationBase"/>s in the given <see cref="IIocContainer"/>
/// Install the needed <see cref="IRegistration"/>s in the given <see cref="IIocContainer"/>
/// </summary>
/// <param name="container">The current <see cref="IIocContainer"/></param>
void Install(IIocContainer container);

@ -1,39 +1,20 @@
// Author: simon.gockner
// Created: 2019-05-20
// Author: Gockner, Simon
// Created: 2019-11-22
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces.Installers;
namespace LightweightIocContainer.Interfaces.Registrations
{
/// <summary>
/// The default registration that is used to register a <see cref="Type"/> for the Interface it implements
/// The <see cref="IDefaultRegistration{TInterface}"/> to register a <see cref="Type"/> for the Interface it implements
/// </summary>
/// <typeparam name="TInterface">The registered Interface</typeparam>
public interface IDefaultRegistration<TInterface> : IRegistrationBase
/// <typeparam name="TInterface">The <see cref="Type"/> of the interface</typeparam>
public interface IDefaultRegistration<TInterface> : IRegistrationBase<TInterface>
{
/// <summary>
/// The <see cref="Type"/> that implements the <see cref="IRegistrationBase.InterfaceType"/> that is registered with this <see cref="IDefaultRegistration{TInterface}"/>
/// The <see cref="Type"/> that implements the <see cref="IRegistration.InterfaceType"/> that is registered with this <see cref="IRegistrationBase{TInterface}"/>
/// </summary>
Type ImplementationType { get; }
/// <summary>
/// The Lifestyle of Instances that are created with this <see cref="IDefaultRegistration{TInterface}"/>
/// </summary>
Lifestyle Lifestyle { get; }
/// <summary>
/// This <see cref="Action{T}"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="OnCreate"/></para>
/// </summary>
Action<TInterface> OnCreateAction { get; }
/// <summary>
/// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this type is created
/// </summary>
/// <param name="action">The <see cref="Action{T}"/></param>
/// <returns>The current instance of this <see cref="IDefaultRegistration{TInterface}"/></returns>
IDefaultRegistration<TInterface> OnCreate(Action<TInterface> action);
}
}

@ -0,0 +1,24 @@
// Author: simon.gockner
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
namespace LightweightIocContainer.Interfaces.Registrations
{
/// <summary>
/// The base registration that is used to register an Interface
/// </summary>
public interface IRegistration
{
/// <summary>
/// The name of the <see cref="IRegistration"/>
/// </summary>
string Name { get; }
/// <summary>
/// The <see cref="Type"/> of the Interface that is registered with this <see cref="IRegistration"/>
/// </summary>
Type InterfaceType { get; }
}
}

@ -3,22 +3,32 @@
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces.Installers;
namespace LightweightIocContainer.Interfaces.Registrations
{
/// <summary>
/// The base registration that is used to register an Interface
/// The <see cref="IRegistrationBase{TInterface}"/> that is used to register an Interface
/// </summary>
public interface IRegistrationBase
/// <typeparam name="TInterface">The registered Interface</typeparam>
public interface IRegistrationBase<TInterface> : IRegistration
{
/// <summary>
/// The name of the <see cref="IRegistrationBase"/>
/// The Lifestyle of Instances that are created with this <see cref="IRegistrationBase{TInterface}"/>
/// </summary>
string Name { get; }
Lifestyle Lifestyle { get; }
/// <summary>
/// The <see cref="Type"/> of the Interface that is registered with this <see cref="IRegistrationBase"/>
/// This <see cref="Action{T}"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="OnCreate"/></para>
/// </summary>
Type InterfaceType { get; }
Action<TInterface> OnCreateAction { get; }
/// <summary>
/// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this type is created
/// </summary>
/// <param name="action">The <see cref="Action{T}"/></param>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
IRegistrationBase<TInterface> OnCreate(Action<TInterface> action);
}
}

@ -10,7 +10,7 @@ namespace LightweightIocContainer.Interfaces.Registrations
/// The registration that is used to register an abstract typed factory
/// </summary>
/// <typeparam name="TFactory">The type of the abstract typed factory</typeparam>
public interface ITypedFactoryRegistration<TFactory> : IRegistrationBase
public interface ITypedFactoryRegistration<TFactory> : IRegistration
{
/// <summary>
/// The class that contains the implemented abstract factory of this <see cref="ITypedFactoryRegistration{TFactory}"/>

@ -5,10 +5,10 @@
namespace LightweightIocContainer.Interfaces.Registrations
{
/// <summary>
/// A special <see cref="IRegistrationBase"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// A special <see cref="IRegistration"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// </summary>
/// <typeparam name="TInterface"></typeparam>
public interface IUnitTestCallbackRegistration<out TInterface> : IRegistrationBase
public interface IUnitTestCallbackRegistration<out TInterface> : IRegistration
{
/// <summary>
/// An <see cref="ResolveCallback{T}"/> that is set as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>

@ -17,19 +17,19 @@ using LightweightIocContainer.Registrations;
namespace LightweightIocContainer
{
/// <summary>
/// The main container that carries all the <see cref="IRegistrationBase"/>s and can resolve all the types you'll ever want
/// The main container that carries all the <see cref="IRegistration"/>s and can resolve all the types you'll ever want
/// </summary>
public class IocContainer : IIocContainer
{
private readonly RegistrationFactory _registrationFactory;
private readonly List<IRegistrationBase> _registrations = new List<IRegistrationBase>();
private readonly List<IRegistration> _registrations = new List<IRegistration>();
private readonly List<(Type type, object instance)> _singletons = new List<(Type, object)>();
private readonly List<(Type type, Type scope, ConditionalWeakTable<object, object> instances)> _multitons = new List<(Type, Type, ConditionalWeakTable<object, object>)>();
/// <summary>
/// The main container that carries all the <see cref="IRegistrationBase"/>s and can resolve all the types you'll ever want
/// The main container that carries all the <see cref="IRegistration"/>s and can resolve all the types you'll ever want
/// </summary>
public IocContainer()
{
@ -57,11 +57,11 @@ namespace LightweightIocContainer
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistration"/></returns>
public IRegistrationBase<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface
{
IDefaultRegistration<TInterface> registration = _registrationFactory.Register<TInterface, TImplementation>(lifestyle);
IRegistrationBase<TInterface> registration = _registrationFactory.Register<TInterface, TImplementation>(lifestyle);
Register(registration);
return registration;
@ -71,11 +71,11 @@ namespace LightweightIocContainer
/// Register a <see cref="Type"/> without an interface
/// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
public IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient)
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistration"/></returns>
public IRegistrationBase<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient)
{
IDefaultRegistration<TImplementation> registration = _registrationFactory.Register<TImplementation>(lifestyle);
IRegistrationBase<TImplementation> registration = _registrationFactory.Register<TImplementation>(lifestyle);
Register(registration);
return registration;
@ -87,7 +87,7 @@ namespace LightweightIocContainer
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <typeparam name="TScope">The Type of the multiton scope</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
public IMultitonRegistration<TInterface> Register<TInterface, TImplementation, TScope>() where TImplementation : TInterface
{
IMultitonRegistration<TInterface> registration = _registrationFactory.Register<TInterface, TImplementation, TScope>();
@ -100,7 +100,7 @@ namespace LightweightIocContainer
/// Register an Interface as an abstract typed factory
/// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
public ITypedFactoryRegistration<TFactory> RegisterFactory<TFactory>()
{
ITypedFactoryRegistration<TFactory> registration = _registrationFactory.RegisterFactory<TFactory>();
@ -114,7 +114,7 @@ namespace LightweightIocContainer
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <param name="unitTestCallback">The <see cref="ResolveCallback{T}"/> for the callback</param>
/// <returns>The created <see cref="IRegistrationBase"/></returns>
/// <returns>The created <see cref="IRegistration"/></returns>
public IUnitTestCallbackRegistration<TInterface> RegisterUnitTestCallback<TInterface>(ResolveCallback<TInterface> unitTestCallback)
{
IUnitTestCallbackRegistration<TInterface> registration = _registrationFactory.RegisterUnitTestCallback(unitTestCallback);
@ -124,11 +124,11 @@ namespace LightweightIocContainer
}
/// <summary>
/// Add the <see cref="IRegistrationBase"/> to the the <see cref="IocContainer"/>
/// Add the <see cref="IRegistration"/> to the the <see cref="IocContainer"/>
/// </summary>
/// <param name="registration">The given <see cref="IRegistrationBase"/></param>
/// <param name="registration">The given <see cref="IRegistration"/></param>
/// <exception cref="MultipleRegistrationException">The <see cref="Type"/> is already registered in this <see cref="IocContainer"/></exception>
private void Register(IRegistrationBase registration)
private void Register(IRegistration registration)
{
//if type is already registered
if (_registrations.Any(r => r.InterfaceType == registration.InterfaceType))
@ -195,7 +195,7 @@ namespace LightweightIocContainer
/// <exception cref="UnknownRegistrationException">The registration for the given <see cref="Type"/> has an unknown <see cref="Type"/></exception>
private T ResolveInternal<T>(object[] arguments, List<Type> resolveStack = null)
{
IRegistrationBase registration = _registrations.FirstOrDefault(r => r.InterfaceType == typeof(T));
IRegistration registration = _registrations.FirstOrDefault(r => r.InterfaceType == typeof(T));
if (registration == null)
throw new TypeNotRegisteredException(typeof(T));

@ -7,7 +7,7 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer
{
/// <summary>
/// The Lifestyles that can be used for a <see cref="IDefaultRegistration{TInterface}"/>
/// The Lifestyles that can be used for a <see cref="IRegistrationBase{TInterface}"/>
/// </summary>
public enum Lifestyle
{

@ -222,12 +222,12 @@
</member>
<member name="T:LightweightIocContainer.Exceptions.UnknownRegistrationException">
<summary>
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> was used
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> was used
</summary>
</member>
<member name="M:LightweightIocContainer.Exceptions.UnknownRegistrationException.#ctor(System.String)">
<summary>
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> was used
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> was used
</summary>
<param name="message">The exception message</param>
</member>
@ -295,7 +295,7 @@
</member>
<member name="T:LightweightIocContainer.Interfaces.IIocContainer">
<summary>
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>s and can resolve all the types you'll ever want
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s and can resolve all the types you'll ever want
</summary>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])">
@ -311,16 +311,16 @@
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface
</summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``3">
<summary>
@ -329,14 +329,14 @@
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterFactory``1">
<summary>
Register an Interface as an abstract typed factory
</summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary>
@ -344,7 +344,7 @@
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<param name="unitTestCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> for the callback</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1">
<summary>
@ -391,64 +391,70 @@
</member>
<member name="M:LightweightIocContainer.Interfaces.Installers.IIocInstaller.Install(LightweightIocContainer.Interfaces.IIocContainer)">
<summary>
Install the needed <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>s in the given <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/>
Install the needed <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s in the given <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/>
</summary>
<param name="container">The current <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/></param>
</member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1">
<summary>
The default registration that is used to register a <see cref="T:System.Type"/> for the Interface it implements
The <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/> to register a <see cref="T:System.Type"/> for the Interface it implements
</summary>
<typeparam name="TInterface">The registered Interface</typeparam>
<typeparam name="TInterface">The <see cref="T:System.Type"/> of the interface</typeparam>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.ImplementationType">
<summary>
The <see cref="T:System.Type"/> that implements the <see cref="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase.InterfaceType"/> that is registered with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
The <see cref="T:System.Type"/> that implements the <see cref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/> that is registered with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/>
</summary>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.Lifestyle">
<member name="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1">
<summary>
The Lifestyle of Instances that are created with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
The registration that is used to register a multiton
</summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.OnCreateAction">
<member name="P:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1.Scope">
<summary>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created.
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.OnCreate(System.Action{`0})"/></para>
The <see cref="T:System.Type"/> of the multiton scope
</summary>
</member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.OnCreate(System.Action{`0})">
<member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistration">
<summary>
Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this type is created
The base registration that is used to register an Interface
</summary>
<param name="action">The <see cref="T:System.Action`1"/></param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></returns>
</member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1">
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.Name">
<summary>
The registration that is used to register a multiton
The name of the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>
</summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1.Scope">
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType">
<summary>
The <see cref="T:System.Type"/> of the multiton scope
The <see cref="T:System.Type"/> of the Interface that is registered with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>
</summary>
</member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase">
<member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1">
<summary>
The base registration that is used to register an Interface
The <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> that is used to register an Interface
</summary>
<typeparam name="TInterface">The registered Interface</typeparam>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase.Name">
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.Lifestyle">
<summary>
The name of the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>
The Lifestyle of Instances that are created with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/>
</summary>
</member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase.InterfaceType">
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.OnCreateAction">
<summary>
The <see cref="T:System.Type"/> of the Interface that is registered with this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created.
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.OnCreate(System.Action{`0})"/></para>
</summary>
</member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.OnCreate(System.Action{`0})">
<summary>
Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this type is created
</summary>
<param name="action">The <see cref="T:System.Action`1"/></param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
</member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1">
<summary>
@ -463,7 +469,7 @@
</member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IUnitTestCallbackRegistration`1">
<summary>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
</summary>
<typeparam name="TInterface"></typeparam>
</member>
@ -474,12 +480,12 @@
</member>
<member name="T:LightweightIocContainer.IocContainer">
<summary>
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>s and can resolve all the types you'll ever want
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s and can resolve all the types you'll ever want
</summary>
</member>
<member name="M:LightweightIocContainer.IocContainer.#ctor">
<summary>
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>s and can resolve all the types you'll ever want
The main container that carries all the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s and can resolve all the types you'll ever want
</summary>
</member>
<member name="M:LightweightIocContainer.IocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])">
@ -495,16 +501,16 @@
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface
</summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register``3">
<summary>
@ -513,14 +519,14 @@
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.RegisterFactory``1">
<summary>
Register an Interface as an abstract typed factory
</summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary>
@ -528,13 +534,13 @@
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<param name="unitTestCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> for the callback</param>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></returns>
<returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member>
<member name="M:LightweightIocContainer.IocContainer.Register(LightweightIocContainer.Interfaces.Registrations.IRegistrationBase)">
<member name="M:LightweightIocContainer.IocContainer.Register(LightweightIocContainer.Interfaces.Registrations.IRegistration)">
<summary>
Add the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> to the the <see cref="T:LightweightIocContainer.IocContainer"/>
Add the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> to the the <see cref="T:LightweightIocContainer.IocContainer"/>
</summary>
<param name="registration">The given <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/></param>
<param name="registration">The given <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></param>
<exception cref="T:LightweightIocContainer.Exceptions.MultipleRegistrationException">The <see cref="T:System.Type"/> is already registered in this <see cref="T:LightweightIocContainer.IocContainer"/></exception>
</member>
<member name="M:LightweightIocContainer.IocContainer.Resolve``1">
@ -640,7 +646,7 @@
</member>
<member name="T:LightweightIocContainer.Lifestyle">
<summary>
The Lifestyles that can be used for a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
The Lifestyles that can be used for a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/>
</summary>
</member>
<member name="F:LightweightIocContainer.Lifestyle.Transient">
@ -660,73 +666,86 @@
</member>
<member name="T:LightweightIocContainer.Registrations.DefaultRegistration`1">
<summary>
The default registration that is used to register a <see cref="T:System.Type"/> for the Interface it implements
The <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/> to register a <see cref="T:System.Type"/> for the Interface it implements
</summary>
<typeparam name="TInterface">The registered Interface</typeparam>
<typeparam name="TInterface">The <see cref="T:System.Type"/> of the interface</typeparam>
</member>
<member name="M:LightweightIocContainer.Registrations.DefaultRegistration`1.#ctor(System.Type,System.Type,LightweightIocContainer.Lifestyle)">
<summary>
The default registration that is used to register a <see cref="T:System.Type"/> for the Interface it implements
The <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/> to register a <see cref="T:System.Type"/> for the Interface it implements
</summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</param>
<param name="implementationType">The <see cref="T:System.Type"/> of the Implementation</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> of the registration</param>
<param name="interfaceType">The <see cref="T:System.Type"/> of the interface</param>
<param name="implementationType">The <see cref="T:System.Type"/> of the implementation</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> of the <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/></param>
</member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.Name">
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.ImplementationType">
<summary>
The name of the <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/>
The <see cref="T:System.Type"/> that implements the <see cref="P:LightweightIocContainer.Registrations.RegistrationBase`1.InterfaceType"/> that is registered with this <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/>
</summary>
</member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.InterfaceType">
<member name="T:LightweightIocContainer.Registrations.MultitonRegistration`1">
<summary>
The <see cref="T:System.Type"/> of the Interface that is registered with this <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/>
The registration that is used to register a multiton
</summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.ImplementationType">
<member name="M:LightweightIocContainer.Registrations.MultitonRegistration`1.#ctor(System.Type,System.Type,System.Type)">
<summary>
The <see cref="T:System.Type"/> that implements the <see cref="P:LightweightIocContainer.Registrations.DefaultRegistration`1.InterfaceType"/> that is registered with this <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/>
The registration that is used to register a multiton
</summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</param>
<param name="implementationType">The <see cref="T:System.Type"/> of the Implementation</param>
<param name="scope">The <see cref="T:System.Type"/> of the Multiton Scope</param>
</member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.Lifestyle">
<member name="P:LightweightIocContainer.Registrations.MultitonRegistration`1.Scope">
<summary>
The <see cref="T:LightweightIocContainer.Lifestyle"/> of Instances that are created with this <see cref="T:LightweightIocContainer.Registrations.DefaultRegistration`1"/>
The <see cref="T:System.Type"/> of the multiton scope
</summary>
</member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.OnCreateAction">
<member name="T:LightweightIocContainer.Registrations.RegistrationBase`1">
<summary>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created.
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Registrations.DefaultRegistration`1.OnCreate(System.Action{`0})"/></para>
The <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/> that is used to register an Interface
</summary>
<typeparam name="TInterface">The registered Interface</typeparam>
</member>
<member name="M:LightweightIocContainer.Registrations.DefaultRegistration`1.OnCreate(System.Action{`0})">
<member name="M:LightweightIocContainer.Registrations.RegistrationBase`1.#ctor(System.Type,LightweightIocContainer.Lifestyle)">
<summary>
Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this <see cref="T:System.Type"/> is created
The <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/> that is used to register an Interface
</summary>
<param name="action">The <see cref="T:System.Action`1"/></param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></returns>
<param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</param>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> of the registration</param>
</member>
<member name="T:LightweightIocContainer.Registrations.MultitonRegistration`1">
<member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.Name">
<summary>
The registration that is used to register a multiton
The name of the <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/>
</summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member>
<member name="M:LightweightIocContainer.Registrations.MultitonRegistration`1.#ctor(System.Type,System.Type,System.Type)">
<member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.InterfaceType">
<summary>
The registration that is used to register a multiton
The <see cref="T:System.Type"/> of the Interface that is registered with this <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/>
</summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</param>
<param name="implementationType">The <see cref="T:System.Type"/> of the Implementation</param>
<param name="scope">The <see cref="T:System.Type"/> of the Multiton Scope</param>
</member>
<member name="P:LightweightIocContainer.Registrations.MultitonRegistration`1.Scope">
<member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.Lifestyle">
<summary>
The <see cref="T:System.Type"/> of the multiton scope
The <see cref="T:LightweightIocContainer.Lifestyle"/> of Instances that are created with this <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/>
</summary>
</member>
<member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.OnCreateAction">
<summary>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created.
<para>Can be set in the <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <see cref="M:LightweightIocContainer.Registrations.RegistrationBase`1.OnCreate(System.Action{`0})"/></para>
</summary>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationBase`1.OnCreate(System.Action{`0})">
<summary>
Pass an <see cref="T:System.Action`1"/> that will be invoked when an instance of this <see cref="T:System.Type"/> is created
</summary>
<param name="action">The <see cref="T:System.Action`1"/></param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
</member>
<member name="T:LightweightIocContainer.Registrations.RegistrationFactory">
<summary>
A factory to register interfaces and factories in an <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> and create the needed <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/>s
A factory to register interfaces and factories in an <see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> and create the needed <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s
</summary>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``2(LightweightIocContainer.Lifestyle)">
@ -735,16 +754,16 @@
</summary>
<typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/> with the given parameters</returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``1(LightweightIocContainer.Lifestyle)">
<summary>
Register a <see cref="T:System.Type"/> without an interface and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
Register a <see cref="T:System.Type"/> without an interface and create a <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/>
</summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/> with the given parameters</returns>
<param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> for this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></param>
<returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> with the given parameters</returns>
</member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``3">
<summary>
@ -799,13 +818,13 @@
</member>
<member name="T:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1">
<summary>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
</summary>
<typeparam name="TInterface"></typeparam>
</member>
<member name="M:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1.#ctor(System.Type,LightweightIocContainer.ResolveCallback{`0})">
<summary>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
A special <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> that allows to set a <see cref="T:LightweightIocContainer.ResolveCallback`1"/> as a callback that is called on <see cref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
</summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the interface</param>
<param name="unitTestResolveCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> that is set as a callback</param>

@ -1,71 +1,34 @@
// Author: simon.gockner
// Created: 2019-05-20
// Author: Gockner, Simon
// Created: 2019-11-22
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations
{
/// <summary>
/// The default registration that is used to register a <see cref="Type"/> for the Interface it implements
/// The <see cref="DefaultRegistration{TInterface}"/> to register a <see cref="Type"/> for the Interface it implements
/// </summary>
/// <typeparam name="TInterface">The registered Interface</typeparam>
public class DefaultRegistration<TInterface> : IDefaultRegistration<TInterface>
/// <typeparam name="TInterface">The <see cref="Type"/> of the interface</typeparam>
public class DefaultRegistration<TInterface> : RegistrationBase<TInterface>, IDefaultRegistration<TInterface>
{
/// <summary>
/// The default registration that is used to register a <see cref="Type"/> for the Interface it implements
/// The <see cref="DefaultRegistration{TInterface}"/> to register a <see cref="Type"/> for the Interface it implements
/// </summary>
/// <param name="interfaceType">The <see cref="Type"/> of the Interface</param>
/// <param name="implementationType">The <see cref="Type"/> of the Implementation</param>
/// <param name="lifestyle">The <see cref="LightweightIocContainer.Lifestyle"/> of the registration</param>
/// <param name="interfaceType">The <see cref="Type"/> of the interface</param>
/// <param name="implementationType">The <see cref="Type"/> of the implementation</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> of the <see cref="RegistrationBase{TInterface}"/></param>
public DefaultRegistration(Type interfaceType, Type implementationType, Lifestyle lifestyle)
: base(interfaceType, lifestyle)
{
InterfaceType = interfaceType;
ImplementationType = implementationType;
Lifestyle = lifestyle;
Name = $"{InterfaceType.Name}, {ImplementationType.Name}, Lifestyle: {Lifestyle.ToString()}";
}
/// <summary>
/// The name of the <see cref="DefaultRegistration{TInterface}"/>
/// </summary>
public string Name { get; }
/// <summary>
/// The <see cref="Type"/> of the Interface that is registered with this <see cref="DefaultRegistration{TInterface}"/>
/// </summary>
public Type InterfaceType { get; }
/// <summary>
/// The <see cref="Type"/> that implements the <see cref="InterfaceType"/> that is registered with this <see cref="DefaultRegistration{TInterface}"/>
/// The <see cref="Type"/> that implements the <see cref="RegistrationBase{TInterface}.InterfaceType"/> that is registered with this <see cref="RegistrationBase{TInterface}"/>
/// </summary>
public Type ImplementationType { get; }
/// <summary>
/// The <see cref="LightweightIocContainer.Lifestyle"/> of Instances that are created with this <see cref="DefaultRegistration{TInterface}"/>
/// </summary>
public Lifestyle Lifestyle { get; }
/// <summary>
/// This <see cref="Action{T}"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="OnCreate"/></para>
/// </summary>
public Action<TInterface> OnCreateAction { get; private set; }
/// <summary>
/// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this <see cref="Type"/> is created
/// </summary>
/// <param name="action">The <see cref="Action{T}"/></param>
/// <returns>The current instance of this <see cref="IDefaultRegistration{TInterface}"/></returns>
public IDefaultRegistration<TInterface> OnCreate(Action<TInterface> action)
{
OnCreateAction = action;
return this;
}
}
}

@ -0,0 +1,62 @@
// Author: simon.gockner
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations
{
/// <summary>
/// The <see cref="RegistrationBase{TInterface}"/> that is used to register an Interface
/// </summary>
/// <typeparam name="TInterface">The registered Interface</typeparam>
public abstract class RegistrationBase<TInterface> : IRegistrationBase<TInterface>
{
/// <summary>
/// The <see cref="RegistrationBase{TInterface}"/> that is used to register an Interface
/// </summary>
/// <param name="interfaceType">The <see cref="Type"/> of the Interface</param>
/// <param name="lifestyle">The <see cref="LightweightIocContainer.Lifestyle"/> of the registration</param>
protected RegistrationBase(Type interfaceType, Lifestyle lifestyle)
{
InterfaceType = interfaceType;
Lifestyle = lifestyle;
}
/// <summary>
/// The name of the <see cref="RegistrationBase{TInterface}"/>
/// </summary>
public string Name { get; protected set; }
/// <summary>
/// The <see cref="Type"/> of the Interface that is registered with this <see cref="RegistrationBase{TInterface}"/>
/// </summary>
public Type InterfaceType { get; }
/// <summary>
/// The <see cref="LightweightIocContainer.Lifestyle"/> of Instances that are created with this <see cref="RegistrationBase{TInterface}"/>
/// </summary>
public Lifestyle Lifestyle { get; }
/// <summary>
/// This <see cref="Action{T}"/> is invoked when an instance of this type is created.
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="OnCreate"/></para>
/// </summary>
public Action<TInterface> OnCreateAction { get; private set; }
/// <summary>
/// Pass an <see cref="Action{T}"/> that will be invoked when an instance of this <see cref="Type"/> is created
/// </summary>
/// <param name="action">The <see cref="Action{T}"/></param>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
public IRegistrationBase<TInterface> OnCreate(Action<TInterface> action)
{
OnCreateAction = action;
return this;
}
}
}

@ -11,7 +11,7 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations
{
/// <summary>
/// A factory to register interfaces and factories in an <see cref="IIocInstaller"/> and create the needed <see cref="IRegistrationBase"/>s
/// A factory to register interfaces and factories in an <see cref="IIocInstaller"/> and create the needed <see cref="IRegistration"/>s
/// </summary>
internal class RegistrationFactory
{
@ -27,20 +27,20 @@ namespace LightweightIocContainer.Registrations
/// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>A new created <see cref="IRegistrationBase{TInterface}"/> with the given parameters</returns>
public IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle) where TImplementation : TInterface
{
return new DefaultRegistration<TInterface>(typeof(TInterface), typeof(TImplementation), lifestyle);
}
/// <summary>
/// Register a <see cref="Type"/> without an interface and create a <see cref="IDefaultRegistration{TInterface}"/>
/// Register a <see cref="Type"/> without an interface and create a <see cref="IRegistrationBase{TInterface}"/>
/// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns>
public IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle)
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>A new created <see cref="IRegistrationBase{TInterface}"/> with the given parameters</returns>
public IRegistrationBase<TImplementation> Register<TImplementation>(Lifestyle lifestyle)
{
if (typeof(TImplementation).IsInterface)
throw new InvalidRegistrationException("Can't register an interface without its implementation type.");

@ -9,13 +9,13 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations
{
/// <summary>
/// A special <see cref="IRegistrationBase"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// A special <see cref="IRegistration"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// </summary>
/// <typeparam name="TInterface"></typeparam>
public class UnitTestCallbackRegistration<TInterface> : IUnitTestCallbackRegistration<TInterface>
{
/// <summary>
/// A special <see cref="IRegistrationBase"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// A special <see cref="IRegistration"/> that allows to set a <see cref="ResolveCallback{T}"/> as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/>
/// </summary>
/// <param name="interfaceType">The <see cref="Type"/> of the interface</param>
/// <param name="unitTestResolveCallback">The <see cref="ResolveCallback{T}"/> that is set as a callback</param>

@ -25,7 +25,7 @@ namespace Test.LightweightIocContainer
{
public void Install(IIocContainer container)
{
container.Register<Mock<IRegistrationBase>>();
container.Register<Mock<IRegistration>>();
}
}
@ -54,7 +54,7 @@ namespace Test.LightweightIocContainer
AssemblyInstaller assemblyInstaller = new AssemblyInstaller(assemblyMock.Object);
assemblyInstaller.Install(iocContainerMock.Object);
iocContainerMock.Verify(ioc => ioc.Register<It.IsSubtype<Mock<IRegistrationBase>>>(It.IsAny<Lifestyle>()), Times.Once);
iocContainerMock.Verify(ioc => ioc.Register<It.IsSubtype<Mock<IRegistration>>>(It.IsAny<Lifestyle>()), Times.Once);
}
[Test]

@ -13,7 +13,7 @@ using NUnit.Framework;
namespace Test.LightweightIocContainer
{
[TestFixture]
public class DefaultRegistrationTest
public class RegistrationBaseTest
{
#region TestClasses
@ -37,7 +37,7 @@ namespace Test.LightweightIocContainer
public void TestOnCreate()
{
RegistrationFactory registrationFactory = new RegistrationFactory(new Mock<IIocContainer>().Object);
IDefaultRegistration<ITest> testRegistration = registrationFactory.Register<ITest, Test>(Lifestyle.Transient).OnCreate(t => t.DoSomething());
IRegistrationBase<ITest> testRegistration = registrationFactory.Register<ITest, Test>(Lifestyle.Transient).OnCreate(t => t.DoSomething());
ITest test = new Test();
Loading…
Cancel
Save