[英]Getting the correct connection string for EF in local db
所有这些都非常新,并且遵循ASP.NET MVC书籍中的说明,因此这是我的本地数据库的样子:
这是我的连接字符串的样子:
<add name="EFDbContext" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=SportsStore;Integrated Security=True" />
我做错了什么吗?
当我运行应用程序时,它崩溃并显示以下消息:
An exception of type 'System.IO.FileLoadException' occurred in Ninject.dll but was not handled in user code
Additional information: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
还有浏览器中的此消息:
Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 11: public class EFProductRepository:IProductsRepository
Line 12: {
Line 13: private EFDbContext context = new EFDbContext();
Line 14:
Line 15: public IQueryable<Product> Products
尝试从NuGet更新您的Entity Framework Package,该错误与数据库无关。
如果我还记得EF6.0有一些错误,那么6.0.1就是在同一天发布的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.