Using SQLite-Net Extensions and SQLiteConnection in Xamarin.Mac

I would like to know how can I use SQLite-Net Extensions in a Xamarin.Mac project?

I am using Xamarin Studio 5.9.5 , I created a project from the project Mac-> App-> Empty (Unified API). Installed SQLite-Net Extensions package. Here is the beginning of my code:

  var db = new SQLiteConnection(???????, dbPath); db.CreateTable<Stock>(); db.CreateTable<Valuation>(); 

How can I call the constructor of SQLiteConnection ? I need the sqlite platform as the first parameter, but there is no SQLite.Net.Platform. in the links SQLite.Net.Platform. dll.

This answer is not useful because there are no such dlls / namespaces ( SQLite.Net.Platform ). Also I can not find this package - SQLite.Net.Platform.XamarinIOS .

I want to use SQLite-Net Extensions because of my one-to-many one-to-one relationships. My question is: How to create an instance of SQLiteConnection?

Why are there no SQLite.Net.Platform.Generic or SQLite.Net.Platform.Win32 in the links from this package?

+8
c # sqlite xamarin xamarin-studio
source share
1 answer

The problem was choosing the type of project. I choose the Empty project , which targets the new Unified API . The package does not require libraries for this SQLiteNetExtensions project, such as SQLite.Net.Platform.Generic .

To solve this problem, you can choose a project aimed at the Classic API (for this project SQLiteNetExtensions contains SQLite.Net.Platform ) or create a Unified API project and manually add SQLite.Net.Platform dlls to the Recommendation after adding the SQLiteNetExtensions package.

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

Here's how it works in my project:

 dbConnection = new SQLiteConnection(new SQLite.Net.Platform.Generic.SQLitePlatformGeneric(), databasePath); 
+7
source share

All Articles