Reputation: 796
I am trying to use System.Data.SQLite in a Windows 7 WPF application.
I have downloaded and installed
sqlite-netFx46-setup-bundle-x86-2015-1.0.103.0.exe
from https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
I have also installed the NuGet packages
EntityFramework version=6.0.0
System.Data.SQLite version=1.0.103
System.Data.SQLite.Core version=1.0.103
System.Data.SQLite.EF6 version=1.0.103
System.Data.SQLite.Linq version=1.0.103
I have tried to create an ADO.Net Entity Data Model and failed. Is this possible. What methods can I use to create the database? Code First? Model First (.edmx)? Hand write SQL code to create the database?
I am having trouble finding documentation on using SQLite with .Net. Is there hope or should I use a different database? Is there documentation that you can direct me towards?
Thanks in advance.
Upvotes: 0
Views: 3056
Reputation: 1017
You can use "code-first" but without migrations. Here's a simple guide on how you can setup your project + migrations using SQLite 3 and EF6: http://hintdesk.com/sqlite-with-entity-framework-code-first-and-migration/. Basically you will have to write all the migrations in SQL by hand.
They are/were planning to add support for migrations in EF7 but they haven't got too far yet: https://github.com/aspnet/EntityFramework/blob/dev/src/Microsoft.EntityFrameworkCore.Sqlite/Migrations/SqliteMigrationsSqlGenerator.cs#L149
There are some SQLite limitations which make this hard to achieve: http://ef.readthedocs.io/en/latest/providers/sqlite/limitations.html#migrations-limitations
Upvotes: 0