Erik
Erik

Reputation: 157

SQLite Entity Framework Azure App sqlite3_blob_open does not have an implementation

TLDR; I'm getting an error when reading from SQLite database deployed to Azure webb app. Works fine locally..

TypeLoadException: Method 'sqlite3_blob_open' in type 'SQLitePCL.SQLite3Provider_e_sqlite3' from assembly 'SQLitePCLRaw.provider.e_sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9c301db686d0bd12' does not have an implementation.

I use the following technologies

enter image description here

It works locally but when I deploy it to the Azure web app I get the following error when trying to read data from the database.

enter image description here

In my startup.cs I have the following

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddDbContext<AppDbContext>(options => options.UseSqlite(@"Data Source=appDatabase.db"));
}

AppDbContext.cs

public class AppDbContext : DbContext
{
    public AppDbContext(DbContextOptions<AppDbContext> options)
        : base(options)
    { }

    public DbSet<Persons> Persons { get; set; }
}

My SQLite database file "appDatabase.db" is placed directly in the web projects folder next to the startup.cs

enter image description here

Upvotes: 3

Views: 1250

Answers (1)

Erik
Erik

Reputation: 157

The issue was fixed after adding another nuget package called SQLitePCLRaw.bundle_e_sqlite3

https://github.com/ericsink/SQLitePCL.raw

https://github.com/ericsink/SQLitePCL.raw

I found this thread https://github.com/praeclarum/sqlite-net/issues/567 that mentioned some sort of bundle package so I searched nuget and found this.

Upvotes: 6

Related Questions