【发布时间】:2015-10-28 19:08:25
【问题描述】:
我在一个解决方案中有 2 个项目,一个 asp.net 5,一个包含 EFModel 的类库项目。我使用 install-package 安装: “实体框架”:“6.1.3”, “EntityFramework.SqlServerCompact”:“6.1.3” 在这两个项目上,并且在 classlibrary\app.config 和 wwwroot\web.config 中都有连接字符串我在互联网上搜索了一些说放置:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
在 web.config 中解决了这个问题,我在 app.config 中有这一部分,当我尝试将它放在 web.config 文件中时,我得到 angularjs 注入错误。我的实体框架代码给我带来了错误: “指定的架构无效。错误:错误 0152:找不到具有不变名称“System.Data.SqlClient”的 ADO.NET 提供程序的实体框架提供程序。确保... 我无法解决这个问题,请帮助。
【问题讨论】:
-
这是 ASP.NET MVC 5 还是 ASP.NET 5(vNext)?如果是这样,那么我想您需要在 project.json 中添加框架依赖项。
-
我已经在 Project.json 文件中有这些依赖项:“EntityFramework”:“6.1.3”,“EntityFramework.SqlServerCompact”:“6.1.3”
-
不确定这个链接有多大帮助stackoverflow.com/questions/20111583/…
-
@mz1378 如果你的目标是 Core 框架,请尝试使用完整版。
-
我的项目 json 中有:"dnx451": { "dependencies": { "DataAccess": "1.0.0-*" } }。
标签: asp.net .net angularjs entity-framework