- 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 namespace LightweightIocContainer.Exceptions
{ {
/// <summary> /// <summary>
/// An unknown <see cref="IRegistrationBase"/> was used /// An unknown <see cref="IRegistration"/> was used
/// </summary> /// </summary>
internal class UnknownRegistrationException : Exception internal class UnknownRegistrationException : Exception
{ {
/// <summary> /// <summary>
/// An unknown <see cref="IRegistrationBase"/> was used /// An unknown <see cref="IRegistration"/> was used
/// </summary> /// </summary>
/// <param name="message">The exception message</param> /// <param name="message">The exception message</param>
public UnknownRegistrationException(string message) public UnknownRegistrationException(string message)

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

@ -12,7 +12,7 @@ namespace LightweightIocContainer.Interfaces.Installers
public interface IIocInstaller public interface IIocInstaller
{ {
/// <summary> /// <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> /// </summary>
/// <param name="container">The current <see cref="IIocContainer"/></param> /// <param name="container">The current <see cref="IIocContainer"/></param>
void Install(IIocContainer container); void Install(IIocContainer container);

@ -1,39 +1,20 @@
// Author: simon.gockner // Author: Gockner, Simon
// Created: 2019-05-20 // Created: 2019-11-22
// Copyright(c) 2019 SimonG. All Rights Reserved. // Copyright(c) 2019 SimonG. All Rights Reserved.
using System; using System;
using LightweightIocContainer.Interfaces.Installers;
namespace LightweightIocContainer.Interfaces.Registrations namespace LightweightIocContainer.Interfaces.Registrations
{ {
/// <summary> /// <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> /// </summary>
/// <typeparam name="TInterface">The registered Interface</typeparam> /// <typeparam name="TInterface">The <see cref="Type"/> of the interface</typeparam>
public interface IDefaultRegistration<TInterface> : IRegistrationBase public interface IDefaultRegistration<TInterface> : IRegistrationBase<TInterface>
{ {
/// <summary> /// <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> /// </summary>
Type ImplementationType { get; } 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. // Copyright(c) 2019 SimonG. All Rights Reserved.
using System; using System;
using LightweightIocContainer.Interfaces.Installers;
namespace LightweightIocContainer.Interfaces.Registrations namespace LightweightIocContainer.Interfaces.Registrations
{ {
/// <summary> /// <summary>
/// The base registration that is used to register an Interface /// The <see cref="IRegistrationBase{TInterface}"/> that is used to register an Interface
/// </summary> /// </summary>
public interface IRegistrationBase /// <typeparam name="TInterface">The registered Interface</typeparam>
public interface IRegistrationBase<TInterface> : IRegistration
{ {
/// <summary> /// <summary>
/// The name of the <see cref="IRegistrationBase"/> /// The Lifestyle of Instances that are created with this <see cref="IRegistrationBase{TInterface}"/>
/// </summary> /// </summary>
string Name { get; } Lifestyle Lifestyle { get; }
/// <summary> /// <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> /// </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 /// The registration that is used to register an abstract typed factory
/// </summary> /// </summary>
/// <typeparam name="TFactory">The type of the abstract typed factory</typeparam> /// <typeparam name="TFactory">The type of the abstract typed factory</typeparam>
public interface ITypedFactoryRegistration<TFactory> : IRegistrationBase public interface ITypedFactoryRegistration<TFactory> : IRegistration
{ {
/// <summary> /// <summary>
/// The class that contains the implemented abstract factory of this <see cref="ITypedFactoryRegistration{TFactory}"/> /// The class that contains the implemented abstract factory of this <see cref="ITypedFactoryRegistration{TFactory}"/>

@ -5,10 +5,10 @@
namespace LightweightIocContainer.Interfaces.Registrations namespace LightweightIocContainer.Interfaces.Registrations
{ {
/// <summary> /// <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> /// </summary>
/// <typeparam name="TInterface"></typeparam> /// <typeparam name="TInterface"></typeparam>
public interface IUnitTestCallbackRegistration<out TInterface> : IRegistrationBase public interface IUnitTestCallbackRegistration<out TInterface> : IRegistration
{ {
/// <summary> /// <summary>
/// An <see cref="ResolveCallback{T}"/> that is set as a callback that is called on <see cref="IIocContainer.Resolve{T}()"/> /// 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 namespace LightweightIocContainer
{ {
/// <summary> /// <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> /// </summary>
public class IocContainer : IIocContainer public class IocContainer : IIocContainer
{ {
private readonly RegistrationFactory _registrationFactory; 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, 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>)>(); private readonly List<(Type type, Type scope, ConditionalWeakTable<object, object> instances)> _multitons = new List<(Type, Type, ConditionalWeakTable<object, object>)>();
/// <summary> /// <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> /// </summary>
public IocContainer() public IocContainer()
{ {
@ -57,11 +57,11 @@ namespace LightweightIocContainer
/// </summary> /// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam> /// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</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> /// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns> /// <returns>The created <see cref="IRegistration"/></returns>
public IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface 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); Register(registration);
return registration; return registration;
@ -71,11 +71,11 @@ namespace LightweightIocContainer
/// Register a <see cref="Type"/> without an interface /// Register a <see cref="Type"/> without an interface
/// </summary> /// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam> /// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param> /// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IRegistrationBase"/></returns> /// <returns>The created <see cref="IRegistration"/></returns>
public IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle = Lifestyle.Transient) 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); Register(registration);
return registration; return registration;
@ -87,7 +87,7 @@ namespace LightweightIocContainer
/// <typeparam name="TInterface">The Interface to register</typeparam> /// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</typeparam> /// <typeparam name="TImplementation">The Type that implements the interface</typeparam>
/// <typeparam name="TScope">The Type of the multiton scope</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 public IMultitonRegistration<TInterface> Register<TInterface, TImplementation, TScope>() where TImplementation : TInterface
{ {
IMultitonRegistration<TInterface> registration = _registrationFactory.Register<TInterface, TImplementation, TScope>(); IMultitonRegistration<TInterface> registration = _registrationFactory.Register<TInterface, TImplementation, TScope>();
@ -100,7 +100,7 @@ namespace LightweightIocContainer
/// Register an Interface as an abstract typed factory /// Register an Interface as an abstract typed factory
/// </summary> /// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam> /// <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>() public ITypedFactoryRegistration<TFactory> RegisterFactory<TFactory>()
{ {
ITypedFactoryRegistration<TFactory> registration = _registrationFactory.RegisterFactory<TFactory>(); ITypedFactoryRegistration<TFactory> registration = _registrationFactory.RegisterFactory<TFactory>();
@ -114,7 +114,7 @@ namespace LightweightIocContainer
/// </summary> /// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam> /// <typeparam name="TInterface">The Interface to register</typeparam>
/// <param name="unitTestCallback">The <see cref="ResolveCallback{T}"/> for the callback</param> /// <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) public IUnitTestCallbackRegistration<TInterface> RegisterUnitTestCallback<TInterface>(ResolveCallback<TInterface> unitTestCallback)
{ {
IUnitTestCallbackRegistration<TInterface> registration = _registrationFactory.RegisterUnitTestCallback(unitTestCallback); IUnitTestCallbackRegistration<TInterface> registration = _registrationFactory.RegisterUnitTestCallback(unitTestCallback);
@ -124,11 +124,11 @@ namespace LightweightIocContainer
} }
/// <summary> /// <summary>
/// Add the <see cref="IRegistrationBase"/> to the the <see cref="IocContainer"/> /// Add the <see cref="IRegistration"/> to the the <see cref="IocContainer"/>
/// </summary> /// </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> /// <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 type is already registered
if (_registrations.Any(r => r.InterfaceType == registration.InterfaceType)) 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> /// <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) 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) if (registration == null)
throw new TypeNotRegisteredException(typeof(T)); throw new TypeNotRegisteredException(typeof(T));

@ -7,7 +7,7 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer namespace LightweightIocContainer
{ {
/// <summary> /// <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> /// </summary>
public enum Lifestyle public enum Lifestyle
{ {

@ -222,12 +222,12 @@
</member> </member>
<member name="T:LightweightIocContainer.Exceptions.UnknownRegistrationException"> <member name="T:LightweightIocContainer.Exceptions.UnknownRegistrationException">
<summary> <summary>
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> was used An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> was used
</summary> </summary>
</member> </member>
<member name="M:LightweightIocContainer.Exceptions.UnknownRegistrationException.#ctor(System.String)"> <member name="M:LightweightIocContainer.Exceptions.UnknownRegistrationException.#ctor(System.String)">
<summary> <summary>
An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"/> was used An unknown <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/> was used
</summary> </summary>
<param name="message">The exception message</param> <param name="message">The exception message</param>
</member> </member>
@ -295,7 +295,7 @@
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.IIocContainer"> <member name="T:LightweightIocContainer.Interfaces.IIocContainer">
<summary> <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> </summary>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])">
@ -311,16 +311,16 @@
</summary> </summary>
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</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> <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.IRegistrationBase"/></returns> <returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``1(LightweightIocContainer.Lifestyle)"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary> <summary>
Register a <see cref="T:System.Type"/> without an interface Register a <see cref="T:System.Type"/> without an interface
</summary> </summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam> <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> <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.IRegistrationBase"/></returns> <returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``3"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.Register``3">
<summary> <summary>
@ -329,14 +329,14 @@
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam> <typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</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>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterFactory``1"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterFactory``1">
<summary> <summary>
Register an Interface as an abstract typed factory Register an Interface as an abstract typed factory
</summary> </summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam> <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>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary> <summary>
@ -344,7 +344,7 @@
</summary> </summary>
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<param name="unitTestCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> for the callback</param> <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>
<member name="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"> <member name="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1">
<summary> <summary>
@ -391,64 +391,70 @@
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.Installers.IIocInstaller.Install(LightweightIocContainer.Interfaces.IIocContainer)"> <member name="M:LightweightIocContainer.Interfaces.Installers.IIocInstaller.Install(LightweightIocContainer.Interfaces.IIocContainer)">
<summary> <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> </summary>
<param name="container">The current <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/></param> <param name="container">The current <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/></param>
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"> <member name="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface">The registered Interface</typeparam> <typeparam name="TInterface">The <see cref="T:System.Type"/> of the interface</typeparam>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.ImplementationType"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.ImplementationType">
<summary> <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> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.Lifestyle"> <member name="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.OnCreateAction"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1.Scope">
<summary> <summary>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created. The <see cref="T:System.Type"/> of the multiton scope
<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>
</summary> </summary>
</member> </member>
<member name="M:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1.OnCreate(System.Action{`0})"> <member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistration">
<summary> <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> </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>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.Name">
<summary> <summary>
The registration that is used to register a multiton The name of the <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>
</summary> </summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IMultitonRegistration`1.Scope"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType">
<summary> <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> </summary>
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase"> <member name="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1">
<summary> <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> </summary>
<typeparam name="TInterface">The registered Interface</typeparam>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase.Name"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.Lifestyle">
<summary> <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> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase.InterfaceType"> <member name="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.OnCreateAction">
<summary> <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> </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>
<member name="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1"> <member name="T:LightweightIocContainer.Interfaces.Registrations.ITypedFactoryRegistration`1">
<summary> <summary>
@ -463,7 +469,7 @@
</member> </member>
<member name="T:LightweightIocContainer.Interfaces.Registrations.IUnitTestCallbackRegistration`1"> <member name="T:LightweightIocContainer.Interfaces.Registrations.IUnitTestCallbackRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface"></typeparam> <typeparam name="TInterface"></typeparam>
</member> </member>
@ -474,12 +480,12 @@
</member> </member>
<member name="T:LightweightIocContainer.IocContainer"> <member name="T:LightweightIocContainer.IocContainer">
<summary> <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> </summary>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.#ctor"> <member name="M:LightweightIocContainer.IocContainer.#ctor">
<summary> <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> </summary>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])"> <member name="M:LightweightIocContainer.IocContainer.Install(LightweightIocContainer.Interfaces.Installers.IIocInstaller[])">
@ -495,16 +501,16 @@
</summary> </summary>
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</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> <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.IRegistrationBase"/></returns> <returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.Register``1(LightweightIocContainer.Lifestyle)"> <member name="M:LightweightIocContainer.IocContainer.Register``1(LightweightIocContainer.Lifestyle)">
<summary> <summary>
Register a <see cref="T:System.Type"/> without an interface Register a <see cref="T:System.Type"/> without an interface
</summary> </summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam> <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> <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.IRegistrationBase"/></returns> <returns>The created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/></returns>
</member> </member>
<member name="M:LightweightIocContainer.IocContainer.Register``3"> <member name="M:LightweightIocContainer.IocContainer.Register``3">
<summary> <summary>
@ -513,14 +519,14 @@
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</typeparam> <typeparam name="TImplementation">The Type that implements the interface</typeparam>
<typeparam name="TScope">The Type of the multiton scope</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>
<member name="M:LightweightIocContainer.IocContainer.RegisterFactory``1"> <member name="M:LightweightIocContainer.IocContainer.RegisterFactory``1">
<summary> <summary>
Register an Interface as an abstract typed factory Register an Interface as an abstract typed factory
</summary> </summary>
<typeparam name="TFactory">The abstract typed factory to register</typeparam> <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>
<member name="M:LightweightIocContainer.IocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})"> <member name="M:LightweightIocContainer.IocContainer.RegisterUnitTestCallback``1(LightweightIocContainer.ResolveCallback{``0})">
<summary> <summary>
@ -528,13 +534,13 @@
</summary> </summary>
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<param name="unitTestCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> for the callback</param> <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>
<member name="M:LightweightIocContainer.IocContainer.Register(LightweightIocContainer.Interfaces.Registrations.IRegistrationBase)"> <member name="M:LightweightIocContainer.IocContainer.Register(LightweightIocContainer.Interfaces.Registrations.IRegistration)">
<summary> <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> </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> <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>
<member name="M:LightweightIocContainer.IocContainer.Resolve``1"> <member name="M:LightweightIocContainer.IocContainer.Resolve``1">
@ -640,7 +646,7 @@
</member> </member>
<member name="T:LightweightIocContainer.Lifestyle"> <member name="T:LightweightIocContainer.Lifestyle">
<summary> <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> </summary>
</member> </member>
<member name="F:LightweightIocContainer.Lifestyle.Transient"> <member name="F:LightweightIocContainer.Lifestyle.Transient">
@ -660,73 +666,86 @@
</member> </member>
<member name="T:LightweightIocContainer.Registrations.DefaultRegistration`1"> <member name="T:LightweightIocContainer.Registrations.DefaultRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface">The registered Interface</typeparam> <typeparam name="TInterface">The <see cref="T:System.Type"/> of the interface</typeparam>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.DefaultRegistration`1.#ctor(System.Type,System.Type,LightweightIocContainer.Lifestyle)"> <member name="M:LightweightIocContainer.Registrations.DefaultRegistration`1.#ctor(System.Type,System.Type,LightweightIocContainer.Lifestyle)">
<summary> <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> </summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</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="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="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> of the <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/></param>
</member> </member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.Name"> <member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.ImplementationType">
<summary> <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> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.InterfaceType"> <member name="T:LightweightIocContainer.Registrations.MultitonRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member> </member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.ImplementationType"> <member name="M:LightweightIocContainer.Registrations.MultitonRegistration`1.#ctor(System.Type,System.Type,System.Type)">
<summary> <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> </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>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.Lifestyle"> <member name="P:LightweightIocContainer.Registrations.MultitonRegistration`1.Scope">
<summary> <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> </summary>
</member> </member>
<member name="P:LightweightIocContainer.Registrations.DefaultRegistration`1.OnCreateAction"> <member name="T:LightweightIocContainer.Registrations.RegistrationBase`1">
<summary> <summary>
This <see cref="T:System.Action`1"/> is invoked when an instance of this type is created. The <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/> that is used to register an Interface
<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>
</summary> </summary>
<typeparam name="TInterface">The registered Interface</typeparam>
</member> </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> <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> </summary>
<param name="action">The <see cref="T:System.Action`1"/></param> <param name="interfaceType">The <see cref="T:System.Type"/> of the Interface</param>
<returns>The current instance of this <see cref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/></returns> <param name="lifestyle">The <see cref="T:LightweightIocContainer.Lifestyle"/> of the registration</param>
</member> </member>
<member name="T:LightweightIocContainer.Registrations.MultitonRegistration`1"> <member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.Name">
<summary> <summary>
The registration that is used to register a multiton The name of the <see cref="T:LightweightIocContainer.Registrations.RegistrationBase`1"/>
</summary> </summary>
<typeparam name="TInterface">The registered interface</typeparam>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.MultitonRegistration`1.#ctor(System.Type,System.Type,System.Type)"> <member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.InterfaceType">
<summary> <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> </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>
<member name="P:LightweightIocContainer.Registrations.MultitonRegistration`1.Scope"> <member name="P:LightweightIocContainer.Registrations.RegistrationBase`1.Lifestyle">
<summary> <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> </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>
<member name="T:LightweightIocContainer.Registrations.RegistrationFactory"> <member name="T:LightweightIocContainer.Registrations.RegistrationFactory">
<summary> <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> </summary>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``2(LightweightIocContainer.Lifestyle)"> <member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``2(LightweightIocContainer.Lifestyle)">
@ -735,16 +754,16 @@
</summary> </summary>
<typeparam name="TInterface">The Interface to register</typeparam> <typeparam name="TInterface">The Interface to register</typeparam>
<typeparam name="TImplementation">The Type that implements the interface</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> <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.IDefaultRegistration`1"/> with the given parameters</returns> <returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> with the given parameters</returns>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``1(LightweightIocContainer.Lifestyle)"> <member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``1(LightweightIocContainer.Lifestyle)">
<summary> <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> </summary>
<typeparam name="TImplementation">The <see cref="T:System.Type"/> to register</typeparam> <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> <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.IDefaultRegistration`1"/> with the given parameters</returns> <returns>A new created <see cref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> with the given parameters</returns>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``3"> <member name="M:LightweightIocContainer.Registrations.RegistrationFactory.Register``3">
<summary> <summary>
@ -799,13 +818,13 @@
</member> </member>
<member name="T:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1"> <member name="T:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1">
<summary> <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> </summary>
<typeparam name="TInterface"></typeparam> <typeparam name="TInterface"></typeparam>
</member> </member>
<member name="M:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1.#ctor(System.Type,LightweightIocContainer.ResolveCallback{`0})"> <member name="M:LightweightIocContainer.Registrations.UnitTestCallbackRegistration`1.#ctor(System.Type,LightweightIocContainer.ResolveCallback{`0})">
<summary> <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> </summary>
<param name="interfaceType">The <see cref="T:System.Type"/> of the interface</param> <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> <param name="unitTestResolveCallback">The <see cref="T:LightweightIocContainer.ResolveCallback`1"/> that is set as a callback</param>

@ -1,71 +1,34 @@
// Author: simon.gockner // Author: Gockner, Simon
// Created: 2019-05-20 // Created: 2019-11-22
// Copyright(c) 2019 SimonG. All Rights Reserved. // Copyright(c) 2019 SimonG. All Rights Reserved.
using System; using System;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations; using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations namespace LightweightIocContainer.Registrations
{ {
/// <summary> /// <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> /// </summary>
/// <typeparam name="TInterface">The registered Interface</typeparam> /// <typeparam name="TInterface">The <see cref="Type"/> of the interface</typeparam>
public class DefaultRegistration<TInterface> : IDefaultRegistration<TInterface> public class DefaultRegistration<TInterface> : RegistrationBase<TInterface>, IDefaultRegistration<TInterface>
{ {
/// <summary> /// <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> /// </summary>
/// <param name="interfaceType">The <see cref="Type"/> of the Interface</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="implementationType">The <see cref="Type"/> of the implementation</param>
/// <param name="lifestyle">The <see cref="LightweightIocContainer.Lifestyle"/> of the registration</param> /// <param name="lifestyle">The <see cref="Lifestyle"/> of the <see cref="RegistrationBase{TInterface}"/></param>
public DefaultRegistration(Type interfaceType, Type implementationType, Lifestyle lifestyle) public DefaultRegistration(Type interfaceType, Type implementationType, Lifestyle lifestyle)
: base(interfaceType, lifestyle)
{ {
InterfaceType = interfaceType;
ImplementationType = implementationType; ImplementationType = implementationType;
Lifestyle = lifestyle;
Name = $"{InterfaceType.Name}, {ImplementationType.Name}, Lifestyle: {Lifestyle.ToString()}"; Name = $"{InterfaceType.Name}, {ImplementationType.Name}, Lifestyle: {Lifestyle.ToString()}";
} }
/// <summary> /// <summary>
/// The name of the <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 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}"/>
/// </summary> /// </summary>
public Type ImplementationType { get; } 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 namespace LightweightIocContainer.Registrations
{ {
/// <summary> /// <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> /// </summary>
internal class RegistrationFactory internal class RegistrationFactory
{ {
@ -27,20 +27,20 @@ namespace LightweightIocContainer.Registrations
/// </summary> /// </summary>
/// <typeparam name="TInterface">The Interface to register</typeparam> /// <typeparam name="TInterface">The Interface to register</typeparam>
/// <typeparam name="TImplementation">The Type that implements the interface</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> /// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns> /// <returns>A new created <see cref="IRegistrationBase{TInterface}"/> with the given parameters</returns>
public IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle) where TImplementation : TInterface public IDefaultRegistration<TInterface> Register<TInterface, TImplementation>(Lifestyle lifestyle) where TImplementation : TInterface
{ {
return new DefaultRegistration<TInterface>(typeof(TInterface), typeof(TImplementation), lifestyle); return new DefaultRegistration<TInterface>(typeof(TInterface), typeof(TImplementation), lifestyle);
} }
/// <summary> /// <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> /// </summary>
/// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam> /// <typeparam name="TImplementation">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface}"/></param> /// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface}"/> with the given parameters</returns> /// <returns>A new created <see cref="IRegistrationBase{TInterface}"/> with the given parameters</returns>
public IDefaultRegistration<TImplementation> Register<TImplementation>(Lifestyle lifestyle) public IRegistrationBase<TImplementation> Register<TImplementation>(Lifestyle lifestyle)
{ {
if (typeof(TImplementation).IsInterface) if (typeof(TImplementation).IsInterface)
throw new InvalidRegistrationException("Can't register an interface without its implementation type."); throw new InvalidRegistrationException("Can't register an interface without its implementation type.");

@ -9,13 +9,13 @@ using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Registrations namespace LightweightIocContainer.Registrations
{ {
/// <summary> /// <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> /// </summary>
/// <typeparam name="TInterface"></typeparam> /// <typeparam name="TInterface"></typeparam>
public class UnitTestCallbackRegistration<TInterface> : IUnitTestCallbackRegistration<TInterface> public class UnitTestCallbackRegistration<TInterface> : IUnitTestCallbackRegistration<TInterface>
{ {
/// <summary> /// <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> /// </summary>
/// <param name="interfaceType">The <see cref="Type"/> of the interface</param> /// <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> /// <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) 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 assemblyInstaller = new AssemblyInstaller(assemblyMock.Object);
assemblyInstaller.Install(iocContainerMock.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] [Test]

@ -13,7 +13,7 @@ using NUnit.Framework;
namespace Test.LightweightIocContainer namespace Test.LightweightIocContainer
{ {
[TestFixture] [TestFixture]
public class DefaultRegistrationTest public class RegistrationBaseTest
{ {
#region TestClasses #region TestClasses
@ -37,7 +37,7 @@ namespace Test.LightweightIocContainer
public void TestOnCreate() public void TestOnCreate()
{ {
RegistrationFactory registrationFactory = new RegistrationFactory(new Mock<IIocContainer>().Object); 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(); ITest test = new Test();
Loading…
Cancel
Save