我有實體框架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="Data Source=C:\Users\MyUser\Desktop\MyProj-master\SignalRSelfHost\ClientLocationSignalHost.sdf""
providerName="System.Data.EntityClient" />
</connectionStrings>
數據庫文件請顯示連接字符串 – Tuco
安裝SQL Server Compact 4.0運行時MSI,爲Visual Studio安裝最新的EF工具,從工具箱連接到數據庫文件 – ErikEJ