Entity Framewok Code First “ADO.NET provider not found” with local SQL Server CE DLL's

限于喜欢 提交于 2019-12-05 03:51:25

See http://tech.aendeavors.com/2011/06/09/bin-deploy-sqlce-4-0-and-ef-4-1/

It seems the relevant bits you might be missing are:

  • Make sure System.Data.SqlServerCe is referenced and set to "Copy local" in properties.

  • Add the following to app.config:


<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>

I was facing the same problem today.
After reinstalling EF several times, what solved my problem was referencing EF in my Console project along with the DAL project (the one that actually uses EF).

If you're using a reference that in turn references EF, you gotta add it to this project as well.

Sorry about the late response - actually, there's a really simple solution:

If you investigate the packages\EntityFramework.6.1.3\lib\net45 folder, you'll notice that there's another dll that's already in there - EntityFramework.SqlServer.

Simply add a reference to that, and everything will work.

I had the same issue and nothing worked for me. The only thing that resolved my this issue for me was to uninstall SQL Server Compact from my machine (via add/remove programs) and re-install it.

In my case, "EntityFramework.SqlServerCompact" package was missing. Just wanted to share if in case it can save someone's day!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!