3

How can I configure entity framework 6.x for Sqlite in Visual Studio 2013. I want to configure my win-form application for SqLite with Entity Framework 6.x. I need process step by step described.

I tried some solutions, but no one is straight forward for the specific system requirement. There is some questions similar this, but in all they are asking to resolve their problem. My point is that, I want a neat step by step process to do this, so that people can get a straight forward way for this thing.

Currently I have installed data provided for .net framework 4.5.1 from here and entity framework 6.0.2 for Sqlite from nuget. But when I am adding Ado.Net Entity Data Model, there is no provider listed for Sqlite db connection.

enter image description here

Haider Ali Wajihi
  • 2,756
  • 7
  • 51
  • 82

2 Answers2

6

Close VS.

Go to this page: http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

Search for this on the page: Setups for 32-bit Windows (.NET Framework 4.5.1) and download the bundle for VS 2013 (The one that sais it's the only one that installs the packages for VS 2013 in bold letters).

Make sure to save the DLLs to GAC and to install the design time components (this does take some time).

Start VS.

You should be able to add connections to an SQLite database file now.

linkerro
  • 5,318
  • 3
  • 25
  • 29
  • I was making that mistake, I was installing 64bit version and it was not working. 32 bit did the job. But I got some error when I tried to connect with database. I added some more info in app.config and now it is working. if you get this error : Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory' Then check this question, check darklektor's answer http://stackoverflow.com/questions/21757843/system-data-sqlite-1-0-91-0-and-ef6-0-2 – Haider Ali Wajihi Jun 04 '15 at 15:06
  • what about other versions, e.g. vs2017? seems highest supported version is vs2013? – Lei Yang Aug 20 '17 at 04:25
3

For Visual Studio 2013, you need to download and install the sqlite-netFx451-setup-bundle-x86-2013-1.0.97.0.exe. In the installation, remember to check the checkboxes: Install the assemblies into the Global Assembly Cache (GAC) and Install the designer components for Visual Studio 2013.

It is important that the SQLite Provider version matches the version of the current SQLite EF6 NuGet package that you use in your project.You can check which version of the SQLite Provider you have installed in Add or Remove Programs, and also check that no older versions of the SQLite Provider are present.

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

enter image description here

You can get more detailed info in this blog and in this post where you can also find a video with the steps you need to follow.

Community
  • 1
  • 1
ocuenca
  • 38,548
  • 11
  • 89
  • 102