I am getting my feet wet with Frank A. Krueger's SQLite.net PCL. I am attempting to use it as the common data layer for an Android app as well as an ASP.NET MVC web application. I have had some success with Android use, but in trying to use it for the web app I get the following exception:
You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().
So, I call this Init function in my controller's constructor, right along with the database initialization:
SQLitePCL.Batteries.Init();
var dbPath = Path.Combine(Constants.DataDir, "SdgData.sqlite3");
var sqliteConnection = new SQLiteConnection(dbPath);
var sdgSqlRepository = new SdgSqlRepository(sqliteConnection);
crm = new CrmManager(sdgSqlRepository);
However, it seems as though the Init isn't even being called - I set a breakpoint on it as well as the next line with the call to Combine, and the second is hit without the first even being noticed. (Possibly because the Init is a PCL library call not applicable to the ASP.NET platform?)
Is there a way to run SQLite.net PCL in an ASP.NET web application, or am I going to have to look for a different data source?
