Asp.net mvc 4 生成视图时无法检索MyApp.Models.MyClass的元数据
我正在利用此链接开发一个应用程序: 生成基本细节视图时,出现以下错误:Asp.net mvc 4 生成视图时无法检索MyApp.Models.MyClass的元数据,asp.net-mvc-4,visual-studio-2013,Asp.net Mvc 4,Visual Studio 2013,我正在利用此链接开发一个应用程序: 生成基本细节视图时,出现以下错误: Unable to retrieve metadata for WebApplication.Models.BasicInfo 这是我的连接字符串: <add name="CompanyEntity" connectionString="metadata=res://*/Models.Employee.csdl|res://*/Models.Employee.ssdl|res://*/Models.Employee
Unable to retrieve metadata for WebApplication.Models.BasicInfo
这是我的连接字符串:
<add name="CompanyEntity" connectionString="metadata=res://*/Models.Employee.csdl|res://*/Models.Employee.ssdl|res://*/Models.Employee.msl;provider=System.Data.SqlClient;provider connection string="data source=myservername;initial catalog=Company;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
EmployeeController类中的我的基本信息:
public ActionResult BasicInfo(BasicInfo Details, string BtnPrevious, string BtnNext)
{
if (BtnNext != null)
{
if (ModelState.IsValid)
{
Employee ObjEmp = GetEmployee();
ObjEmp.EmployeeName = Details.EmpName;
ObjEmp.CompanyName = Details.CompName;
return View("AddressInfo");
}
}
return View();
}
我不确定您的操作结果是什么,但该错误意味着连接字符串有问题
public ActionResult BasicInfo(BasicInfo Details, string BtnPrevious, string BtnNext)
{
if (BtnNext != null)
{
if (ModelState.IsValid)
{
Employee ObjEmp = GetEmployee();
ObjEmp.EmployeeName = Details.EmpName;
ObjEmp.CompanyName = Details.CompName;
return View("AddressInfo");
}
}
return View();
}