我在简单的mvc应用程序中创建模型。创建模型类文件后,我在解决方案中添加控制器。但是我无法添加它。
1这是模型类文件
namespace MvcApplication1.Models
{
public class student
{
public int Id { get; set; }
public string Name { get; set; }
public int Salary { get; set; }
}
public class studentDbcontext : DbContext
{
public DbSet<student> students { get; set; }
}
}
2还web.config
档
<connectionStrings>
<add name="DefaultConnection" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=(local);initial catalog=Test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.SqlClient" />
<add name="studentDbcontext" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=(local);initial catalog=Test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.SqlClient" />
我面临的3个错误......