because of seem overwhelming difficulties around entity framework, i’m in process of moving dapper. have application uses both remote ms sql server database , small local database (sqlite). dapper against ms sql server database working great, reason can’t sqlite connection working.
from way understand it, dapper needs ado connection. installed nuget package “sqlite-net”, , used following code create connection:
sqliteconnection con = new sqliteconnection(“data source=c:\data\onedrive\data\testdb.sqlite”);
and
sqliteconnection con = new sqliteconnection(“data source=c:\data\onedrive\data\testdb.sqlite; version=3”);
neither 1 of these work , throw exception “could not open database file”. file sqlite.cs (coming nuget package) threw error.
because of past problems deployment, i’ve hesitated installing downloaded files system.data.sqlite.org.
please can me?
looking @ nuget package , sqlite.cs file:
https://github.com/praeclarum/sqlite-net/blob/master/src/sqlite.cs
i see following constructor definition (line 180):
public sqliteconnection (string databasepath, bool storedatetimeasticks = true) : (databasepath, sqliteopenflags.readwrite | sqliteopenflags.create, storedatetimeasticks) { }
this shows first argument path, , should called like:
sqliteconnection con = new sqliteconnection(@"c:\data\onedrive\data\testdb.sqlite”);
the @ sign escapes \ characters being interpreted character codes. these 2 issues problem have , try out , see if works.