'No Entity Framework provider found' for EF 6 and SQLite 1.0.96.0

38,850

Solution 1

I solved same error with just add a single line in App.config

<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>

PS: Add provider to <configuration> > <entityFramework> > <providers>

Solution 2

Here is a working 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" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>

  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
    </providers>
  </entityFramework>

  <connectionStrings>
    <!-- use AppDomain.SetData to set the DataDirectory -->
    <add name="MapDbConnectionStr" connectionString="Data Source=|DataDirectory|MapDb.sqlite" providerName="System.Data.SQLite" />
  </connectionStrings>

  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description="Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>



</configuration>

Solution 3

I finally got it too work

I'm using : EF 6.1.3 http://www.microsoft.com/en-us/download/details.aspx?id=40762 and System.Data.SQLite 1.0.96.0 sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe

I followed the description written in: Database first create entity framework 6.1.1 model using system.data.sqlite 1.0.93 (in this description a nuget package of entity framwork is installed -i did it too)

For the app.config file i used these fixes: https://stackoverflow.com/a/24324212/885349 (written by tomexou)

Finally SQLite Connector wasn't shown in the ADO.Net Entity Data Model Mapper

The missing link was the \bin folder. I had to set the "Copy Local" = true setting for following dlls:

  • SQLite.Designer
  • System.Data.SQLite
  • System.Data.SQLite.EF6
  • System.Data.SQLite.Linq

Only for completeness - added through Nuget and also in \bin folder

  • EntityFramework
  • EntityFramework.SqlServer

And the SQLite Connection was shown...

Solution 4

After searching for a week i believe this problem is a feature in development by the sqlite team.

More information can be found here SQLite connection not appearing in Entity Data Model Wizard

edit: Maybe looking into some different providers might seem worthwhile. Although i have not tested this myself, http://www.devart.com/dotconnect/ offers some promising alternatives and states EF compatibility.

Solution 5

Try these tweaks:

<providers>
  ...
  <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
</providers>

<system.data>
    <DbProviderFactories>
        <remove invariant="System.Data.SQLite.EF6" />
        <add name="SQLite Data Provider" invariant="System.Data.SQLite" description="Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
</system.data>

See Entity Framework 6 + SQLite

Share:
38,850

Related videos on Youtube

Simon
Author by

Simon

Updated on July 09, 2022

Comments

  • Simon
    Simon almost 2 years

    I realize there are already several similar questions on this topic, but many of them are from older version of SQLite which did not fully support EF 6 as far as I am aware. I have tried countless suggestions from these threads and am either doing something wrong or something must have changed.

    I am using VS 2013, targeting .NET 4.5.1 and have installed the sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe package from the system.data.sqlite.org download page, as well as the System.Data.SQLite EF6 package from the NuGet Manager (which installs EF6).

    Below is my current App.config file (it is pretty much untouched except I tried adding the Version, Culture, and Public key variables to the type):

    <?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" />
      </configSections>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
      </startup>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mssqllocaldb" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
          <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
        </providers>
      </entityFramework>
      <system.data>
        <DbProviderFactories>
          <remove invariant="System.Data.SQLite.EF6" />
          <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"
          />
        </DbProviderFactories>
      </system.data>
    </configuration>
    

    And my packages.config:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="EntityFramework" version="6.1.2" targetFramework="net451" />
      <package id="System.Data.SQLite.EF6" version="1.0.96.0" targetFramework="net451" />
    </packages>
    

    If I do something such as attempt to Generate a Database from Model I see the following error:

    No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SQLite.EF6'. Make sure the provider is registered in the 'entityFramework' section...

    I've tried messing around the the App.config file and adding other providers and providers as old threads have suggested but to no avail.

    How do I fix this problem? Any help is greatly appreciated!

    Edit: I managed to get it to work well enough to use a database first approach. Here is the relevant parts of my App.config file:

    <providers>
         <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
    
    <DbProviderFactories>
         <remove invariant="System.Data.SQLite" />
         <remove invariant="System.Data.SQLite.EF6" />
         <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
         <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
    

    I'm using EF 6.1.2 and System.Data.SQLite 1.0.96.0.

    • Ian McLaird
      Ian McLaird almost 7 years
      I had to also add System.Data.SQLite
  • Simon
    Simon about 9 years
    I'm still seeing the same error. Just to clarify, I should leave the other entry for SQLite in the <providers> section right? So there is one for System.Data.SQLite.EF6 and System.Data.SQLite. Either way, it isn't working. I'm able to see/create a data connection as I was before, but it fails on execution.
  • Steve Greene
    Steve Greene about 9 years
    My issue came after updating, so I changed my config as shown in the link. What does your connection string look like?
  • Simon
    Simon about 9 years
    metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/D‌​bModel.msl;provider=‌​System.Data.SQLite.E‌​F6;provider connection string="data source=C:\sqlite_test\testDb"
  • Steve Greene
    Steve Greene about 9 years
    My provider is just System.Data.SQLite; Not sure that would matter.
  • Simon
    Simon about 9 years
    If I remove the System.Data.SQLite invariant from <providers>, SQLite is no longer shown as a Data source in the Generate Database Wizard datasource window though. I'm at a bit of a loss on this one.
  • Simon
    Simon about 9 years
    Thanks for the response. I did end up getting it functioning well enough (without some of the VS design tools) to do what I needed, but hopefully it is easier to setup in future versions.
  • ImP
    ImP about 9 years
    May i ask what you did to solve your problem, maybe it can help me with mine :)
  • Simon
    Simon about 9 years
    To be honest, it was a few weeks ago and a lot of fiddling. I decided to use a database first approach as it was a relatively simple app, and that did work. I'll post my App.config properties as an edit above. Hopefully that helps! Good luck!
  • dsum
    dsum almost 8 years
    The answer looks related to : stackoverflow.com/questions/26327811/…
  • BennyM
    BennyM about 7 years
    No idea why this is so hard to find. Hero.
  • Dan
    Dan over 6 years
    Solved it for me, thanks. Wonder why it wasn't autogenerated.
  • Lakshman Pilaka
    Lakshman Pilaka almost 6 years
    will second @Dan
  • Ihab
    Ihab over 4 years
    This is the only thing that has worked for me after wasting so much time on different solutions !