升级企业库版本5.0到6.0时,我得到EnterpriseLibraryCoreExtension未定义错误.
码:
container.AddNewExtension(Of EnterpriseLibraryCoreExtension)
Run Code Online (Sandbox Code Playgroud)
当我用Google搜索时,我得到了以下解决方案.有谁能提供任何实例来实现以下解决方案?
Enterprise Library块不再使用Unity容器来解析实例.您应该从代码中删除对Unity容器的AddNewExtension方法的所有调用.如果您的应用程序当前从容器中解析Enterprise Library对象,则必须在Unity容器中手动注册所需类型,或者修改应用程序以使用块中的静态外观来配置和检索应用程序使用的Enterprise Library对象.
控制器:
public ActionResult Insert()
{
return View();
}
public ActionResult Insert(Employee emp)
{
Employee emp1 = new Employee();
emp1.insert(emp);
return View();
}
Run Code Online (Sandbox Code Playgroud)
CSHTML
@using (Html.BeginForm("Employee", "Insert", FormMethod.Post))
{
@Html.TextBoxFor(model => model.name)
@Html.TextBoxFor(model => model.Email)
@Html.TextBoxFor(model => model.mob)
<input type="button" value="Register me" />
}
Run Code Online (Sandbox Code Playgroud)
我必须在按钮点击('注册我')上保存我的模型值.提前致谢.