I am currently working on a Xamarin project using a SQLite database. We are creating views using ExecuteSqlCommand and in one of these views I need to use ROW_NUMBER, which is only supported in SQLite3.
This is fine for UWP and Android as the 'SQLitePCLRaw.bundle_green' NuGet package (Which 'Microsoft.EntityFrameworkCore.Sqlite' uses) supports SQLite 3, but iOS is different and doesn't support SQLite3 by default.
In the NuGet package for 'SQLitePCLRaw.bundle_green' it does say "Policy of this bundle: iOS=system SQLite, others=e_sqlite3 included". It also talks about how it uses the same configuration on everything except iOS so that explains why iOS is the only platform with this issue.
I tried adding a couple of the providers for SQLite to get it to support a later version but wasn't having any success. I assume there must be some way to change this for iOS but searching for information on "iOS=system SQLite" just beings up the SQLite home page and a bunch of unrelated pages.
I can change the query to not use SQLite 3, but it feels stupid to support SQLite3 on the other 2 platforms but not be able to use it because of iOS.
Is there some NuGet Package that I can add to the iOS project so that we can use SQLite3 queries?
In your iOS AppDelegate: Before you call
you need to call:
Also, you need to set the following somewhere, it's an attribute and can be set almost anywhere:
[assembly: Preserve(typeof(System.Linq.Queryable), AllMembers = true)]
AND you cannot use DynamicProxy. All of this is due to AOT, I am not going to explain any of this, it is all in other answers.