We have a class (in fact many) that have a static initialization function that it needs to carry out on an object within the dependency injection container (using Unity).
public class MyClass
{
public static void InitializeMappings(IMapper mapper)
{
// Do stuff to mapper
}
}
I would like the InitializeMappings function to be called whenever a new IMapper instance is instantiated by the Unity container.
I need help to:
- Call the
InitializeMappingsfunction from the container - Resolve the
mapperparameter for the function call - Connect up the call to
InitializeMappingsto the lifetime of IMapper implementations
How would I go about implementing/defining this?