Zdaję sobie sprawę, że istnieje już kilka podobnych pytań na ten temat, ale wiele z nich pochodzi ze starszej wersji SQLite, która nie w pełni wspiera EF 6, o ile Jestem świadom. Próbowałem niezliczonych sugestii z tych wątków i albo robię coś źle, albo coś się zmieniło."Nie znaleziono dostawcy Entity Framework" dla EF 6 i SQLite 1.0.96.0
Używam VS 2013, kierując na .NET 4.5.1 i zainstalowałem pakiet sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe z system.data.sqlite.org download page, a także System.Data. Pakiet SQLite EF6 z NuGet Manager (który instaluje EF6).
Poniżej jest mój bieżący plik App.config (jest to prawie nietknięte wyjątkiem Próbowałem dodając wersja, kultury oraz klucz publiczny do zmiennych typu):
<?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>
i mój 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>
Gdybym coś takiego jak próba wygenerowania bazy danych z modelu widzę następujący błąd:
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...
Próbowałem ingerować w plik App.config i dodawać innych dostawców i dostawców, jak sugerowały stare wątki, ale bezskutecznie.
Jak naprawić ten problem? Każda pomoc jest bardzo cenna!
Edycja: Udało mi się zmusić go do pracy na tyle dobrze, aby korzystać z pierwszego podejścia do bazy danych. Oto odpowiednie części mojego pliku app.config:
<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>
Używam EF 6.1.2 i System.Data.SQLite 1.0.96.0.
musiałem * również * dodać 'System.Data.SQLite' –