我想知道最佳實踐在這裏。 我需要構建的DbContext我的多租戶應用程序,所以我已經做了相關供應商這樣的:Ninject Providers - >獲取提供者內部的另一個依賴關係
public class TenantContextFactoryProvider : Provider<DbContext>
{
protected override DbContext CreateInstance(IContext context)
{
var tenant = // How to get the tenant through ninject??
return new DbContext(tenant.ConnectionString);
}
}
我需要ninject解決租戶的依賴,但我不知道如何做到這一點?
不錯,我不知道你能做到這一點,我錯誤地認爲,當我進入ninject時,我無法訪問這些功能。 –