Xamarin SQlitePlatformAndroid()失踪

时间:2017-07-13 21:09:14

标签: c# xamarin

我正在尝试使用SQLite而我找不到SQLitePlatformAndroid

enter image description here

2 个答案:

答案 0 :(得分:0)

您需要在Android项目中添加SQLite NuGet包,并将命名空间添加到文件中。

SQLite.Net.Platform.XamarinAndroid

答案 1 :(得分:0)

在所有项目中添加 SQLite.Net-PCL

  public SQLiteConnection GetConnection()
    {
        var sqliteFilename = "Test.db3";
        string documentsPath = 
       System.Environment.GetFolderPath(System.Environment.
        SpecialFolder.Personal);
        // Documents folder
        var path = Path.Combine(documentsPath, sqliteFilename);
        var plat = new 
        SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid();
        var conn = new SQLiteConnection(plat, path);
        // Return the database connection
        return conn;
    }
相关问题