具有多个参数的“绑定”的Ninject语法
我如何在Ninject语法中使用多个参数,如下所示?
Bind() .To() .WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString );
如果需要传递多个参数怎么办?
您可以将调用链接到WithConstructorArgument
:
Bind() .To() .WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString) .WithConstructorArgument("timeout", 10000);
- 没有为“Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory”类型提供服务
- ASP.net MVC – 导航并突出显示“当前”链接
- 如何在MVC3中的Razor页面上使用Enums?
- c#引用其他类的静态属性时的线程安全性
- 如何在MVC3 / Razor中正确重定向(同时设置cookie)?
- MVC 2查看显示错误的模型信息
- 使用Razor的FormsAuthentication无效
- ‘System.Web.Mvc.HtmlHelper’不包含’RenderPartial’的定义 – ASP.Net MVC
- Mvc 4添加带脚手架的控制器给出错误 – “无法检索元数据……”