我對Frank A. Krueger的SQLite.net PCL感到很沮喪。我試圖將它用作Android應用程序以及ASP.NET MVC Web應用程序的公共數據層。我已經取得了一些成功的Android應用,但在嘗試使用它爲Web應用程序,我得到以下異常:無法在ASP.NET MVC中運行SQLite.net PCL
You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().
所以,我呼籲我的控制器的構造這個Init
功能,對伴隨着數據庫初始化:
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);
然而,似乎好像Init
甚至沒有被稱爲 - 我設置一個斷點上,以及與呼叫Combine
下一行,第二個是打不首先甚至被注意到。 (可能是因爲Init
是PCL庫調用不適用於ASP.NET平臺?)
有沒有辦法在ASP.NET Web應用程序中運行SQLite.net PCL,或者我將不得不看看爲不同的數據源?
這SQLitePCL項目是您使用進口
參考解決這個問題?那裏有太多的東西。 – Searching
Frank A. Krueger - https://github.com/praeclarum/sqlite-net – NargothBond