对于所有这些并且遵循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
答案 0 :(得分:1)
尝试从NuGet更新您的Entity Framework Package,该错误与数据库无关。
如果我记得EF6.0有一些错误,并且6.0.1发布的同一天。