生成视图时无法检索MyApp.Models.MyClass的元数据

时间:2013-10-22 12:50:06

标签: asp.net-mvc-4 visual-studio-2013

我正在借助此链接开发应用程序:

http://www.binaryintellect.net/articles/9a5fe277-6e7e-43e5-8408-a28ff5be7801.aspx

在生成BasicDetails的视图时,收到此错误:

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=&quot;data source=myservername;initial catalog=Company;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

我正在MVC5中创建这个应用程序。

我的BasicInfo类:

public class BasicInfo
{
    public string EmpName { get; set; }
    public string CompName { get; set; }
}

EmployeeController类中的My BasicInfo:

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();
    }

1 个答案:

答案 0 :(得分:0)

我不确定您的操作结果是做什么的,但错误意味着连接字符串有问题。