- pass parameters that will be used to create an instance of the registered type
- add new method `UpdateArgumentsWithRegistrationParameters()` that handles these parameters in the `CreateInstance<>()` method
/// 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>
/// </summary>
object[]Parameters{get;}
/// <summary>
/// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para>
/// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving</para>
/// </summary>
/// <param name="parameters">The parameters with their position</param>
/// <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>
/// Update the given arguments with the <see cref="IRegistrationBase{TInterface}.Parameters"/> of the given <see cref="IRegistrationBase{TInterface}"/>
/// </summary>
/// <typeparam name="T">The given <see cref="Type"/></typeparam>
/// <param name="registration">The <see cref="IRegistrationBase{TInterface}"/> of the given <see cref="Type"/></param>
if(!(currentParameterisInternalResolvePlaceholder))//use the parameter at the current index if it is not a placeholder
{
newArguments[i]=currentParameter;
continue;
}
}
objectfirstArgument=arguments.FirstOrGiven<object,InternalResolvePlaceholder>(a=>!(aisInternalResolvePlaceholder));//find the first argument that is not a placeholder
if(firstArgumentisInternalResolvePlaceholder)//no more arguments available
An <seecref="T:System.Array"/> of parameters that are used to <seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Can be set in the <seecref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <seecref="M:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.WithParameters(System.Object[])"/></para>
Pass parameters that will be used to<seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para>
</summary>
<paramname="parameters">The parameters</param>
<returns>The current instance of this <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
<exceptioncref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.Parameters"/> are already set or no parameters given</exception>
Pass parameters that will be used to<seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving</para>
</summary>
<paramname="parameters">The parameters with their position</param>
<returns>The current instance of this <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
<exceptioncref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.Parameters"/> are already set or no parameters given</exception>
The <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> to register either only an interface or only a <seecref="T:System.Type"/>
@ -496,6 +520,11 @@
An <seecref="T:LightweightIocContainer.ResolveCallback`1"/> that is set as a callback that is called on <seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/>
The main container that carries all the <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s and can resolve all the types you'll ever want
@ -629,6 +658,15 @@
<paramname="resolveStack">The current resolve stack</param>
<returns>A newly created instance of the given <seecref="T:System.Type"/></returns>
Update the given arguments with the <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1.Parameters"/> of the given <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/>
</summary>
<typeparamname="T">The given <seecref="T:System.Type"/></typeparam>
<paramname="registration">The <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/> of the given <seecref="T:System.Type"/></param>
An <seecref="T:System.Array"/> of parameters that are used to <seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Can be set in the <seecref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> by calling <seecref="M:LightweightIocContainer.Registrations.RegistrationBase`1.WithParameters(System.Object[])"/></para>
Pass parameters that will be used to<seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para>
</summary>
<paramname="parameters">The parameters</param>
<returns>The current instance of this <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
<exceptioncref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><seecref="P:LightweightIocContainer.Registrations.RegistrationBase`1.Parameters"/> are already set or no parameters given</exception>
Pass parameters that will be used to<seecref="M:LightweightIocContainer.Interfaces.IIocContainer.Resolve``1"/> an instance of this <seecref="P:LightweightIocContainer.Interfaces.Registrations.IRegistration.InterfaceType"/>
<para>Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving</para>
</summary>
<paramname="parameters">The parameters with their position</param>
<returns>The current instance of this <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistrationBase`1"/></returns>
<exceptioncref="T:LightweightIocContainer.Exceptions.InvalidRegistrationException"><seecref="P:LightweightIocContainer.Registrations.RegistrationBase`1.Parameters"/> are already set or no parameters given</exception>
A factory to register interfaces and factories in an <seecref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> and create the needed <seecref="T:LightweightIocContainer.Interfaces.Registrations.IRegistration"/>s
/// 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>
/// </summary>
publicobject[]Parameters{get;privateset;}
/// <summary>
/// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving</para>
thrownewInvalidRegistrationException($"Don't use `WithParameters()` method twice (Type: {InterfaceType}).");
if(parameters==null||!parameters.Any())
thrownewInvalidRegistrationException($"No parameters given to `WithParameters()` method (Type: {InterfaceType}).");
Parameters=parameters;
returnthis;
}
/// <summary>
/// Pass parameters that will be used to<see cref="IIocContainer.Resolve{T}()"/> an instance of this <see cref="IRegistration.InterfaceType"/>
/// <para>Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving</para>
/// </summary>
/// <param name="parameters">The parameters with their position</param>
/// <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>