Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

SQLite.net extensions in a shared project

$
0
0

Ive searched pretty extensively and come across some posts which do not seem to address what I am experiencing but I'll try to step through what I have encountered.

I have a Xamarin forms app using shared code and at the time was using the raw source code for SQLite.net as recommended for a shared code project in the Xamarin docs. I am using SQLite.Net without issue and wanted to add in the sqlite extensions to use some of it's features. Initially I an into the problems I've seen in other posts where there is a conflict between using the sqlite.net code and the nuget package for the extensions. I would get errors with respect to SQLite.net not dealing with generic lists. Following some other recommendations I deleted the raw sqlite.cs file and installed the sqlite-net-extensions nuget package and it brought in the version of SQLite.net it needed. I was concerned because it was described as being PCL and I wasn't sure if it would work in a shared project.

Now I see that all the references to sqlite.* need to be changed to sqlite.net.* so I set up a simple test project and for the life of me I can't get anything to compile. To get a connection to the SQLite db before I included the extensions I used:

var conn = new SQLite.SQLiteConnection(path);

For the path I would get a platform specific path. Not the new package int the SQLite.Net.SQLiteconnection constructor it wants an additional platform parameter which I can find no example on how to use. I have also tried setting it up as recommend for PCL app using the dependency resolver. That also fails for the same missing parameter reason.

In short, is there a way to use the sqlite-net extensions in a xamarin forms shared app?

These are some of the posts I came across which don't appear to apply to my current errors:

https://forums.xamarin.com/discussion/20117/sqlite-net-extensions-and-sqliteconnection

https://forums.xamarin.com/discussion/20385/sqlite-extension-with-shared-project


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>