Closed SimonG96 closed 4 years ago
To do this, there has to be a registration (maybe ITypedRegistrationBase
) that has a generic parameter TImplementation
:
public interface ITypedRegistrationBase<TInterface, TImplementation> : IRegistrationBase<TInterface>, IOnCreate<TImplementation>
Use a non-generic interface IOnCreate
that contains an Action
with parameter object
:
public interface IOnCreate
{
Action<object> NonGenericOnCreateAction { get; }
}
The generic IOnCreate<TImplementation>
has to implement this non-generic interface, and the OnCreate()
method has to set the new Action
as well.
Maybe the IOnCreate<>.OnCreateAction
could be removed and the new Action
could be used.
The
OnCreate()
method should not pass the registered interface to create an action:https://github.com/SimonG96/LightweightIocContainer/blob/c25896a56e648e232076acb681773bd7f72f7e6a/LightweightIocContainer/Interfaces/Registrations/FluentProviders/IOnCreate.cs#L27
It should pass the implementation that is registered for the given interface.
This simplifies #33 because we don't need to have multiple
Action<T>
for anOnCreate()
method.