Using SQLite-Net Extensions and SQLiteConnection in Xamarin.Mac

前端 未结 1 826
天命终不由人
天命终不由人 2021-02-08 21:09

I\'d like to know, how can I use SQLite-Net Extensions within Xamarin.Mac project?

I\'m using Xamarin Studio 5.9.5, I\'ve created project from Mac->App->Emp

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 21:33

    The problem was in project type I choose. I choose Empty project that targets the new Unified API. For that project SQLiteNetExtensions package doesn’t have required libraries, such as SQLite.Net.Platform.Generic.

    To solve that problem you could either choose project that targets Classic API (for that project SQLiteNetExtensions contains SQLite.Net.Platform) or create Unified API project and after adding SQLiteNetExtensions package, manually add SQLite.Net.Platform dlls to references.

    Although, I'm not sure why these .Platform libraries are included in SQLiteNetExtensions package for Classic API and not for Unified API

    This is how it works in my project:

    dbConnection = new SQLiteConnection(new SQLite.Net.Platform.Generic.SQLitePlatformGeneric(), databasePath);
    

    0 讨论(0)
提交回复
热议问题