Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Troubleshooting SQLite with the Entity Framework 6 Designer

DZone's Guide to

Troubleshooting SQLite with the Entity Framework 6 Designer

SQLite database with the Entity Framework 6 EDM Wizard and Designer is a popular toolset, but it's also rife with problems.

· Database Zone ·
Free Resource

Compliant Database DevOps and the role of DevSecOps DevOps is becoming the new normal in application development, and DevSecOps is now entering the picture. By balancing the desire to release code faster with the need for the same code to be secure, it addresses increasing demands for data privacy. But what about the database? How can databases be included in both DevOps and DevSecOps? What additional measures should be considered to achieve truly compliant database DevOps? This whitepaper provides a valuable insight. Get the whitepaper

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

In order to use the Entity Data Model Wizard to generate a Code First or 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 fromhttp://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-1.0.94.0.exe  for the current version of the ADO.NET provider, so 1.0.94 might change to 1.0.95 or higher in the future.

image

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

image

Once installed, you can add a connection to your SQLite database from Server Explorer:

image

image

image

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:

image

This package will install all other required dependencies, including Entity Framework 6.1.1.

After installation of this package in a project that target .NET 4.5, your packages.config should look like this:

image

And the system.data section of your app.config file should look like this:

image

Now BUILD your project

You should now be able to add a EDMX or Code First based model to your project, using Add New Item. Data, ADO.NET Entity Data Model:

image

If you are unable to see the connection to the SQLite database we made earlier, here are a couple of tips:

Try building the project and possible changing the build configuration to x86 has worked for me.

Installing the Entity Framework 6.1.2-beta2 tools have worked very well for me – download link in the blog post here. I think it is due to this fix in the Tools beta.

Hope this helps! 

Compliant Database DevOps and the role of DevSecOps DevOps is becoming the new normal in application development, and DevSecOps is now entering the picture. By balancing the desire to release code faster with the need for the same code to be secure, it addresses increasing demands for data privacy. But what about the database? How can databases be included in both DevOps and DevSecOps? What additional measures should be considered to achieve truly compliant database DevOps? This whitepaper provides a valuable insight. Get the whitepaper

Topics:
sql ,dotnet ,microsoft ,tools ,visual studio ,.net & windows ,ms-office dev ,windows phone

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}