I’ve created a controller factory and registered my types in code. I can do the following:
public class HomeController : Controller
{
public MasterEntities DbContext { get { return Container.Resolve<MasterEntities>(); }
}
public ActionResult Index()
{
//DbContext can be used here properly...
}
}
However I would like to have the property injected in the setter instead of having to call Container.Resolve<TypeName>() explicitly. Preferrable without using attributes or some configuration in code…
public MasterEntities DbContext { get; set; }
How can this be configured in my .config file? Or does this require the use of attributes or configuration in code?
should do the trick.