I have the below windsor statement and trying to convert it into a structuremap statement. I really can’t find any suggestion how to do it.
Container.Register(AllTypes.FromThisAssembly().
BasedOn<IType>().If(MatchStatement).Configure(c => c.LifeStyle.Transient.
Named(c.Implementation.Name)));
Anyone knows how this is written with structuremap?
EDIT: To make it more clear.. I’ve got the statement above (almost anyway) written with Windsor Castle but as we will be using Structuremap instead I need to do the same but with Structuremap. I got pieces of it but not all;
Registry.Scan(x =>
{
x.TheCallingAssembly();
x.AddAllTypesOf<IType>();
//{What more?}
});
What I further need is to meet the MatchStatement condition and return the named instance.
StructureMap’s default lifecycle is PerGraph (a mix of transient and singleton).
The following code scans the calling assembly and adds all implentations of
ITypeand each implementation is registered with the name of the implementation.