Get container instance in registry class in structuremap 4

159 views Asked by At

How do I upgrade following code to Structuremap 4.

This code in one of the Registry inherited class where I don't get Container instance to replace ObjectFactory.GetNamedInstance

public class DI:Registry
{
 public DI(){
For<IloanFactory>().Use((loantype) =>
{
switch(loantype)
{
   case "home": 
   return ObjectFactory.GetNamedInstance<ILoan>("regularhome")
   case "car":
      return ObjectFactory.GetNamedInstance<ILoan>("regularcar")
   ......

}
});

}
}
0

There are 0 answers