Cannot run SQLite.net PCL in ASP.NET MVC Cannot run SQLite.net PCL in ASP.NET MVC sqlite sqlite

Cannot run SQLite.net PCL in ASP.NET MVC


This can be fixed by installing the nuGet package Microsoft.EntityFrameworkCore.Sqlite (beware, not Microsoft.EntityFrameworkCore.Sqlite.Core)


I have the same issue I fix it by import

SQLitePCLRaw.bundle_e_sqlite3SQLitePCLRaw.bundle_sqlcipherSQLitePCLRaw.bundle_green

reference

https://github.com/ericsink/SQLitePCL.raw/wiki/SQLitePCL.Batteries.Init


Current solution i found is that i have to call it like below ...

Although i am not happy with the solution and i want to do a deep dig but moving forward with this solution for now -

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)        {            string dbPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);            if (!optionsBuilder.IsConfigured)            {                optionsBuilder.UseSqlite($@"Data Source={dbPath}\sqlite\.sample.sqlite");                Batteries.Init();                base.OnConfiguring(optionsBuilder);            }        }