Many users would like to be able to use the SQLite database with the Entity Framework 6 EDM Wizard and Designer, but looking at Stack Overflow, they often face problems attempting to do that. This blog post describes the steps required to do that, and gives some troubleshooting advice and tips.
Install the SQLite DDEX provider
UPDATE: This blog post describes how to generate and use an EDMX file with SQLite. I have not tested “Code First from Database”, and “Generate Database from Model” does not work with SQLite. In addtion, Code First Migrations are not supported with SQLite. If you want these additional capabilities in an embedded database, use the SQL Server Compact provider. If you encounter issues with the SQLite provider, suggest you post an issue here.
In order to use the Entity Data Model Wizard to generate an EDMX Model from an existing database, you must be able to connect to the database from Server Explorer in Visual Studio. In order to do that, a so called DDEX provider for the database and Visual Studio version in use must be installed.
For SQLite you must download the provider from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki - this page is an unreadable mess, sadly.
For Visual Studio 2013, the download you need is named: sqlite-netFx451-setup-bundle-x86-2013-188.8.131.52.exe for the current version of the ADO.NET provider, so 1.0.96 might change to 1.0.97 or higher in the future.
It is important that the DDEXprovider version matches the version of the current SQLite EF6 NuGet package that you use in your project!
Make sure to enable Visual Studio integration and GAC registration during installation.
You can check which version of the DDEX provider you have installed in “Add or Remove Programs”, and also check that no older versions of the DDEX provider are present:
Once installed, you can add a connection to your SQLite database from Server Explorer:
Add the correct SQLite EF6 NuGet package to your project
To demonstrate using the SQLite EF6 provider, let’s go through creating a console app in Visual Studio 2013, that uses the Chinook sample database that we connected to above.
To add the SQLite EF6 provider to your project, select the System.Data.SQLite.EF6 package:
This package will install all other required dependencies, including Entity Framework 6.1.2.
After installation of this package in a project that target .NET 4.5, your packages.config should look like this (notice that with version 1.0.95 of the SQLite provider, only a single package is required);
And the system.data section of your app.config file should be modified to look like this (notice the added <remove> and <add> statements);
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider"
description=".NET Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
Important: Now BUILD your project!
You should now be able to add a EDMX based model to your project, using Add New Item. Data, ADO.NET Entity Data Model:
Add some code to the Main method to test that the application also works in runtime:
using (var db = new ChinookEntities())
var albums = db.Albums.ToList();
foreach (var item in albums)
If you are unable to see the connection to the SQLite database we made earlier, here are a couple of tips:
Make sure to build the project and possibly changing the build configuration to x86 has worked for me.
Installing the latest Entity Framework 6.1.2 Visual Studio tools have worked very well for me (the version 6.1.1 Tools are included in Visual Studio 2013 Update 4) – download link in the blog post here. I think it is due to this fix in the Tools.
Hope this helps!