我使用SQLite.Net在Visual Studio中使用控制檯應用程序構建了我的應用程序的核心邏輯,我認爲我只是簡單地將使用語句從Mono.Data.Sqlite.dll與SQLite.Net的兼容
using System.Data.SQLite;
到
using Mono.Data.Sqlite.dll
這個過程完全適用於其它組件工作(Json.Net例如)。
但是我發現兩個Sqlite DLL(SQL和Sql)之間的套管差異。
System.Data.SQLite
SQLiteCommand command = new SQLiteCommand(sql, DbConnection);
SQLiteDataReader reader = command.ExecuteReader();
Mono.Data.Sqlite
SqliteCommand command = new SqliteCommand(sql, DbConnection);
SqliteDataReader reader = command.ExecuteReader();
它很容易與全球發現糾正和替換,但其有點討厭每次我必須在不同環境之間切換。任何人都可以提出解決方案
我認爲使用抽象層(即工廠模式)來避免這種情況要好得多。 – boj