2015-10-30 15 views
1

我有实体框架6.13,我安装了EntityFramework.SqlServerCompact.6.1.3 NuGet包。实体框架和SQL Server精简版 - 数据库提供者不兼容

然而,当我尝试添加从数据库中生成一个新的模式,我得到错误:

Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible with this version could not be found for your data connection. If you have already installed a compatible provider, ensure you have rebuilt your project before performing this action. Otherwise, exit this wizard, install a compatible provider, and rebuild your project before performing this action.

我已经SQL Server CE 4.3安装。

部分 app.config文件

<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> 
<connectionStrings> 
    <add name="DataBaseModelContainer" 
     connectionString="metadata=res://*/DataBaseModel.csdl|res://*/DataBaseModel.ssdl|res://*/DataBaseModel.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;Data Source=C:\Users\MyUser\Desktop\MyProj-master\SignalRSelfHost\ClientLocationSignalHost.sdf&quot;" 
     providerName="System.Data.EntityClient" />  
</connectionStrings> 
+0

数据库文件请显示连接字符串 – Tuco

+0

安装SQL Server Compact 4.0运行时MSI,为Visual Studio安装最新的EF工具,从工具箱连接到数据库文件 – ErikEJ

回答

1

安装的SQL Server Compact 4.0运行MSI,安装Visual Studio的最新的EF工具,连接到从SQL Server精简工具箱