0
votes

There are many questions on Stackoverflow on this topic. I tried most of the proposed answers but none of them worked for me.

  • My setup : Win 7 32 bits + VS2013 Update 5
  • I installed sqlite-netFx46-setup-bundle-x86-2015-1.0.108.0.exe (full install)
  • Then I created a new .NET 4.6 console project
  • Then I installed SQLite Nuget packages
  • Additionally, I built my project in AnyCPU and made another attempt in x86
  • Then I tried to add entity data model (Add -> New Items -> ADO.NET Entity Data Model)

Whatever the option I chose (EF Designer, Code First) no provider for SQlite is visible when I try to create the connection.

My configuration file :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <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.6" />
    </startup>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="v11.0" />
            </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" />
        </providers>
    </entityFramework>
    <system.data>
        <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" />
        </DbProviderFactories>
    </system.data>
</configuration>

My package config :

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.0.0" targetFramework="net46" />
  <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" />
</packages>

EDIT : adding screenshots to clarify the question :

There i should be able to set a connection to my SQLite DB

What did i do wrong ? Thanks for your help !

1
"no provider for SQlite is visible" - visible where? What are you looking at? - Crowcoder
It was in my question, but probably need more clarification. I edited the question with a screen shot. - Poilaupat

1 Answers

0
votes

Ok, i just figured out what's happening. I simply did not install the proper provider. I should have install sqlite-netFx451-setup-bundle-x86-2013-1.0.108.0.exe

It's not very clear in the System.Data.SQLite wiki, but the year in the file name, is not the release date as i thought, but the VisualStudio version. My mistake was to choose the provider by the desired target .NET version.

Once the correct provider was installed, all just went fine, even if the provider targets .NET 4.5.1 and my project targets .NET 4.6