我想用Code First先私人部署SQL CE WPF与实体框架6。SQLCE 4私人部署实体框架6
在开发计算机数据库,应用程序数据文件夹中生成细和所有测试PC上我得到一个异常(没有DB),但是工作得很好:
"The ADO.NET provide with invariant name 'System.Data.SQlServerCe.40' is either not registered in the machine or application config file'
我试图执行关于这个问题的所有现有的文献,但仍然有问题。我已经使用Deployed Folder检查了Bin文件夹,它也是一样的,所有库(x86和amd64)都存在,并且Project Platform目标是x86。
- No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'
- http://erikej.blogspot.dk/2013/11/entity-framework-6-sql-server-compact-4_25.html
- Entity Framewok Code First "ADO.NET provider not found" with local SQL Server CE DLL's
贝娄是我的App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<contexts>
<context type="MyProject.DAL.GreatContext, MyProject">
<databaseInitializer type="MyProject.Module.Database.Dal.GreatDbInitializer, MyProject" />
</context>
</contexts>
<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>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0"
invariant="System.Data.SqlServerCe.4.0"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
</configuration>
我也开始加入了波纹管代码,但仍问题仍然存在:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
有什么想法?
是包含在你的项目什么System.Data.SqlServerCe.dll的程序集版本? – ErikEJ 2014-10-16 18:29:21