Skip to content

Sqlite Support

Artiom Chilaru edited this page Nov 3, 2018 · 4 revisions

Upsert support was added to SQLite only in June 2018, in version 3.24.0 [1]

As such, if the application is using the embedded system version of SQLite, it might not have support for this command yet, and the upsert command will fail.

If this is the case, you may be able to load a custom, newer version of SQLite and pass that to EF Core.

You'll have to add a reference to the SQLitePCLRaw.provider.sqlite3.netstandard11 package, which loads the external sqlite3 standard dynamic library instead of the embedded old one, and prevent other packages from loading other versions:

SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
SQLitePCL.raw.FreezeProvider();
dbContextOptions.UseSqlite(connectionString);
  • On Windows platform, you can copy Sqlite 3.24.0 binary to the output directory. The dynamic libraries in the current execution path will load first
  • On Linux platform, you can install newer Sqlite3 package using package managers like apt or yum, or compile the Sqlite3 v3.24.0 from its source tarball. This installs a systemwide Sqlite3 lib.
  • On MacOS X, upgrade to the newest 10.14 then the systemwide preinstalled Sqlite3 lib has been 3.24.0.

References:

Clone this wiki locally