@ -16,10 +16,7 @@ namespace LightweightIocContainer.Registrations
{
{
private readonly IIocContainer _ iocContainer ;
private readonly IIocContainer _ iocContainer ;
internal RegistrationFactory ( IIocContainer container )
internal RegistrationFactory ( IIocContainer container ) = > _ iocContainer = container ;
{
_ iocContainer = container ;
}
/// <summary>
/// <summary>
/// Register an Interface with a Type that implements it and create a <see cref="IDefaultRegistration{TInterface,TImplementation}"/>
/// Register an Interface with a Type that implements it and create a <see cref="IDefaultRegistration{TInterface,TImplementation}"/>
@ -28,16 +25,18 @@ namespace LightweightIocContainer.Registrations
/// <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,TImplementation}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IDefaultRegistration{TInterface,TImplementation}"/></param>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface,TImplementation}"/> with the given parameters</returns>
/// <returns>A new created <see cref="IDefaultRegistration{TInterface,TImplementation}"/> with the given parameters</returns>
public IDefaultRegistration < TInterface , TImplementation > Register < TInterface , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface
public IDefaultRegistration < TInterface , TImplementation > Register < TInterface , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface = >
{
new DefaultRegistration < TInterface , TImplementation > ( typeof ( TInterface ) , typeof ( TImplementation ) , lifestyle ) ;
return new DefaultRegistration < TInterface , TImplementation > ( typeof ( TInterface ) , typeof ( TImplementation ) , lifestyle ) ;
}
/// <summary>
/// Register an open generic Interface with an open generic Type that implements it and create a <see cref="IOpenGenericRegistration"/>
/// </summary>
/// <param name="tInterface">The open generic Interface to register</param>
/// <param name="tImplementation">The open generic Type that implements the interface</param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IOpenGenericRegistration"/></param>
/// <returns>The created <see cref="IOpenGenericRegistration"/></returns>
public IOpenGenericRegistration Register ( Type tInterface , Type tImplementation , Lifestyle lifestyle ) = > new OpenGenericRegistration ( tInterface , tImplementation , lifestyle ) ;
public IOpenGenericRegistration Register ( Type tInterface , Type tImplementation , Lifestyle lifestyle )
{
return new OpenGenericRegistration ( tInterface , tImplementation , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2}"/>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2}"/>
/// </summary>
/// </summary>
@ -46,10 +45,8 @@ namespace LightweightIocContainer.Registrations
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2}"/></returns>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2}"/></returns>
public IMultipleRegistration < TInterface1 , TInterface2 , TImplementation > Register < TInterface1 , TInterface2 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2
public IMultipleRegistration < TInterface1 , TInterface2 , TImplementation > Register < TInterface1 , TInterface2 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 = >
{
new MultipleRegistration < TInterface1 , TInterface2 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TImplementation ) , lifestyle ) ;
return new MultipleRegistration < TInterface1 , TInterface2 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TImplementation ) , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3}"/>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3}"/>
@ -60,10 +57,8 @@ namespace LightweightIocContainer.Registrations
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3}"/></returns>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3}"/></returns>
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3 = >
{
new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TImplementation ) , lifestyle ) ;
return new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TImplementation ) , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4}"/>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4}"/>
@ -75,10 +70,8 @@ namespace LightweightIocContainer.Registrations
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4}"/></returns>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4}"/></returns>
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3 , TInterface4
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3 , TInterface4 = >
{
new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TInterface4 ) , typeof ( TImplementation ) , lifestyle ) ;
return new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TInterface4 ) , typeof ( TImplementation ) , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4,TInterface5}"/>
/// Register multiple interfaces for a <see cref="Type"/> that implements them and create a <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4,TInterface5}"/>
@ -91,10 +84,8 @@ namespace LightweightIocContainer.Registrations
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <typeparam name="TImplementation">The <see cref="Type"/> that implements both interfaces</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="IRegistrationBase{TInterface}"/></param>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4,TInterface5}"/></returns>
/// <returns>The created <see cref="IMultipleRegistration{TInterface1,TInterface2,TInterface3,TInterface4,TInterface5}"/></returns>
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5
public IMultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > Register < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > ( Lifestyle lifestyle ) where TImplementation : TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 = >
{
new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TInterface4 ) , typeof ( TInterface5 ) , typeof ( TImplementation ) , lifestyle ) ;
return new MultipleRegistration < TInterface1 , TInterface2 , TInterface3 , TInterface4 , TInterface5 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TInterface3 ) , typeof ( TInterface4 ) , typeof ( TInterface5 ) , typeof ( TImplementation ) , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register a <see cref="Type"/> without an interface and create a <see cref="ISingleTypeRegistration{TInterface}"/>
/// Register a <see cref="Type"/> without an interface and create a <see cref="ISingleTypeRegistration{TInterface}"/>
@ -102,10 +93,7 @@ namespace LightweightIocContainer.Registrations
/// <typeparam name="T">The <see cref="Type"/> to register</typeparam>
/// <typeparam name="T">The <see cref="Type"/> to register</typeparam>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="ISingleTypeRegistration{TInterface}"/></param>
/// <param name="lifestyle">The <see cref="Lifestyle"/> for this <see cref="ISingleTypeRegistration{TInterface}"/></param>
/// <returns>A new created <see cref="ISingleTypeRegistration{TInterface}"/> with the given parameters</returns>
/// <returns>A new created <see cref="ISingleTypeRegistration{TInterface}"/> with the given parameters</returns>
public ISingleTypeRegistration < T > Register < T > ( Lifestyle lifestyle )
public ISingleTypeRegistration < T > Register < T > ( Lifestyle lifestyle ) = > new SingleTypeRegistration < T > ( typeof ( T ) , lifestyle ) ;
{
return new SingleTypeRegistration < T > ( typeof ( T ) , lifestyle ) ;
}
/// <summary>
/// <summary>
/// Register an Interface with a Type that implements it as a multiton and create a <see cref="IMultitonRegistration{TInterface,TImplementation}"/>
/// Register an Interface with a Type that implements it as a multiton and create a <see cref="IMultitonRegistration{TInterface,TImplementation}"/>
@ -114,10 +102,8 @@ namespace LightweightIocContainer.Registrations
/// <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>A new created <see cref="IMultitonRegistration{TInterface,TImplementation}"/> with the given parameters</returns>
/// <returns>A new created <see cref="IMultitonRegistration{TInterface,TImplementation}"/> with the given parameters</returns>
public IMultitonRegistration < TInterface , TImplementation > RegisterMultiton < TInterface , TImplementation , TScope > ( ) where TImplementation : TInterface
public IMultitonRegistration < TInterface , TImplementation > RegisterMultiton < TInterface , TImplementation , TScope > ( ) where TImplementation : TInterface = >
{
new MultitonRegistration < TInterface , TImplementation > ( typeof ( TInterface ) , typeof ( TImplementation ) , typeof ( TScope ) ) ;
return new MultitonRegistration < TInterface , TImplementation > ( typeof ( TInterface ) , typeof ( TImplementation ) , typeof ( TScope ) ) ;
}
/// <summary>
/// <summary>
/// Register multiple interfaces for a <see cref="Type"/> that implements them as a multiton
/// Register multiple interfaces for a <see cref="Type"/> that implements them as a multiton
@ -127,19 +113,14 @@ namespace LightweightIocContainer.Registrations
/// <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>A new created <see cref="IMultipleMultitonRegistration{TInterface1,TInterface2,TImplementation}"/> with the given parameters</returns>
/// <returns>A new created <see cref="IMultipleMultitonRegistration{TInterface1,TInterface2,TImplementation}"/> with the given parameters</returns>
public IMultipleMultitonRegistration < TInterface1 , TInterface2 , TImplementation > RegisterMultiton < TInterface1 , TInterface2 , TImplementation , TScope > ( ) where TImplementation : TInterface1 , TInterface2
public IMultipleMultitonRegistration < TInterface1 , TInterface2 , TImplementation > RegisterMultiton < TInterface1 , TInterface2 , TImplementation , TScope > ( ) where TImplementation : TInterface1 , TInterface2 = >
{
new MultipleMultitonRegistration < TInterface1 , TInterface2 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TImplementation ) , typeof ( TScope ) ) ;
return new MultipleMultitonRegistration < TInterface1 , TInterface2 , TImplementation > ( typeof ( TInterface1 ) , typeof ( TInterface2 ) , typeof ( TImplementation ) , typeof ( TScope ) ) ;
}
/// <summary>
/// <summary>
/// Register an Interface as an abstract typed factory and create a <see cref="ITypedFactoryRegistration{TFactory}"/>
/// Register an Interface as an abstract typed factory and create a <see cref="ITypedFactoryRegistration{TFactory}"/>
/// </summary>
/// </summary>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <typeparam name="TFactory">The abstract typed factory to register</typeparam>
/// <returns>A new created <see cref="ITypedFactoryRegistration{TFactory}"/> with the given parameters</returns>
/// <returns>A new created <see cref="ITypedFactoryRegistration{TFactory}"/> with the given parameters</returns>
public ITypedFactoryRegistration < TFactory > RegisterFactory < TFactory > ( )
public ITypedFactoryRegistration < TFactory > RegisterFactory < TFactory > ( ) = > new TypedFactoryRegistration < TFactory > ( typeof ( TFactory ) , _ iocContainer ) ;
{
return new TypedFactoryRegistration < TFactory > ( typeof ( TFactory ) , _ iocContainer ) ;
}
}
}
}
}