Using .Net Entity Data Model with SQLite

.net c# entity-framework entity-framework-6 sqlite

Question

I'm attempting to convert a c# application currently running on SQL Server 2014 LocalDB over to SQLite, which appears to do the same job but is much lighter. I spent the whole day reading about it and installing various components.

The problem is that I can't find a way to either migrate my Entity Framework 6 database schema. Nor can I successfully create a new database schema from the SQLite database. Does the Visual Studio 2013 data model designer work with SQLite? How can I get my entity objects created and working properly?

** I'm not looking to create the database tables with a code-first model. I got my database structure already. I'm only looking to query the database with LINQ.

I installed the SQLite package from (the one that provides design-time support for Visual Studio 2013) https://system.data.sqlite.org/

I installed System.Data.SQLite (x86/x64) into my project from NuGet http://www.nuget.org/packages/System.Data.SQLite/

I followed these instructions http://vijayt.com/Post/Using-SQLite-database-in-NET-with-LINQ-to-SQL-

If I go in Server Explorer, I'm able to add the SQLite connection. When I add a new item to the project "ADO.NET Entity Data Model", and then select "EF Designer from database", and then "New Connection", the only options it offers are SQL Server and SQL Server Database File. If the SQLite connection is in App.Config, it appears in the list and I can use it, but it doesn't work properly.

So... what do I do from here?

1
2
5/27/2015 1:16:42 AM

Popular Answer

Visual Studio data model designer definitely works with sqlite, checked yesterday with VS2013 community edition.

Things you need

  • Sqlite bundle with designer support here https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki I don't know your platform, it can be sqlite-netFx451-setup-bundle-x86-2013-1.0.97.0.exe or sqlite-netFx451-setup-bundle-x64-2013-1.0.97.0.exe. This is the only setup package that is capable of installing the design-time components for Visual Studio 2013. Personally i have 32 bit system with 32 bit visual studio
  • Entity framework 6 tools for VS2012/VS213 https://www.microsoft.com/en-us/download/details.aspx?id=40762, be sure you download for VS2013
  • Add nuget package System.Data.SQLite (x86/x64) 1.0.97 to your project (version does matter) Only after these steps you can list Sqlite connection in Entity Data Model Wizard.

    P.S. Design time support for VS2012 and VS2013 is mutually exclusive

    P.P.S After such drivers personally i want to stay away from System.Data.Sqlite, i even can't complile my project ported from VS2010 with original old drivers 1.0.88 in modern Visusual Studio

3
8/14/2019 11:19:47 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow