In StructureMap you could declare a Forward<,>
statement, that would allow for registering a single concrete instance to be resolved by multiple interfaces from the StructureMap documentation:
var container = new Container(_ =>
{
// Let's make StatefulCache a SingletonThing in the container
_.ForConcreteType<StatefulCache>().Configure.Singleton();
_.Forward<StatefulCache, IReader>();
_.Forward<StatefulCache, IWriter>();
});
container.GetInstance<IReader>().ShouldBeOfType<StatefulCache>();
container.GetInstance<IWriter>().ShouldBeOfType<StatefulCache>();
I am looking at potentially migrating to Lamar, the replacement for StructureMap but I am not seeing anything matching this in the registration options.
Is this possible in Lamar?