我试图实例化HomedataAccess类,它以字符串和接口IQueryManager作为构造函数参数。我如何注册? 到现在我已经做了以下和它的作品,但我不喜欢这样: Kernel.Register(() => new HomeDataAccess("anandv4",
new SqlServerQueryManager(new SqlServerConnectionManager())
假设我正在为一所学校开发一个代码优先的开发项目,并且我有一个SchoolDbContext。在实体框架绝大多数文档建议你获得从DbContext: public class SchoolDbContext : DbContext
{
public IDbSet<Student> Students => Set<Student>();
}
但我的观点是SchoolDbContext
如何使用Simple Injector DI容器注册IShipper接口的多种具体类型,并使用name动态选择它们? 如果我无法注册同一类型的多个实例,是否有与简单注入器不同的方法? public Setup()
{
var container = new SimpleInjector.Container();
// TODO: Registration required f