Reputation: 24292
I'm Trying to work with SQLITE database using visual studio 2013. I have installed System.Data.SQLite (x86/x64) 1.0.92 to visual studio. And installed the Setups for 64-bit Windows (.NET Framework 4.5) as well.
Problems
It gives me and exception when i'm trying to create database using code first.
SQL logic error or missing database no such table: ****
Cannot create Entity Data Model using existing database. No provider is there to create connection. So Cannot Use Model First
Success Scenario
Is there any way to overcome above problems.
Upvotes: 1
Views: 3799
Reputation: 24292
Entity framework 6 for SQLITE is not supporting Database/ Table creation when you use code first.
You need to create database manually and create tables using ExecuteSqlCommand
SQLiteConnection.CreateFile(filePath);
Database.ExecuteSqlCommand(SqLiteQueries.CreateEnterpriseApplicationsTable);
OR as mentioned in the question Success Scenario, it support the code first with existing database.
Upvotes: 1
Reputation: 1231
I believe there is.
<configuration
>
<startup useLegacyV2RuntimeActivationPolicy ="true"
>
<suppurtedRuntime
version="v4.0"/>
</
startup>
</configuration
>
(I couldn't insert the XAML code here correctly so check before copying or type it manually)
-In case there is a problem with your connection string use;
public static string ConnectionString = @"Data Source = databasename.db;Version=3; "
The last thing means that I suggest you to use SQLite3.
Upvotes: 0