@ -43,25 +43,6 @@ namespace LightweightIocContainer.Registrations
/// </summary>
/// </summary>
public Lifestyle Lifestyle { get ; }
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 ;
}
/// <summary>
/// <summary>
/// An <see cref="Array"/> of parameters that are used to <see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// An <see cref="Array"/> of parameters that are used to <see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="WithParameters(object[])"/></para>
/// <para>Can be set in the <see cref="IIocInstaller"/> by calling <see cref="WithParameters(object[])"/></para>
@ -75,7 +56,7 @@ namespace LightweightIocContainer.Registrations
/// <param name="parameters">The parameters</param>
/// <param name="parameters">The parameters</param>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception>
public IRegistrationBase < TInterface > WithParameters ( params object [ ] parameters )
public virtual IRegistrationBase < TInterface > WithParameters ( params object [ ] parameters )
{
{
if ( Parameters ! = null )
if ( Parameters ! = null )
throw new InvalidRegistrationException ( $"Don't use `WithParameters()` method twice (Type: {InterfaceType})." ) ;
throw new InvalidRegistrationException ( $"Don't use `WithParameters()` method twice (Type: {InterfaceType})." ) ;
@ -94,7 +75,7 @@ namespace LightweightIocContainer.Registrations
/// <param name="parameters">The parameters with their position</param>
/// <param name="parameters">The parameters with their position</param>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
/// <returns>The current instance of this <see cref="IRegistrationBase{TInterface}"/></returns>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception>
/// <exception cref="InvalidRegistrationException"><see cref="Parameters"/> are already set or no parameters given</exception>
public IRegistrationBase < TInterface > WithParameters ( params ( int index , object parameter ) [ ] parameters )
public virtual IRegistrationBase < TInterface > WithParameters ( params ( int index , object parameter ) [ ] parameters )
{
{
if ( Parameters ! = null )
if ( Parameters ! = null )
throw new InvalidRegistrationException ( $"Don't use `WithParameters()` method twice (Type: {InterfaceType})." ) ;
throw new InvalidRegistrationException ( $"Don't use `WithParameters()` method twice (Type: {InterfaceType})." ) ;