Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin SQLite PCL implementation

I'm creating a Xamarin application with a PCL and I would like to use SQLite in the PCL to share the database code within the platform specific projects.

I've already looked into the Tasky Portable project, where they are using an abstract class to reach this goal. I've had some trouble implementing this method, which is why I was looking for another solution to use SQLite within a PCL. I stumbled upon an Xamarin Forms article where they are using the SQLite PCL NuGet package to implement it in a PCL.

Since I'm not using Xamarin Forms, what is the difference between these two methods? Can the NuGet package solution also be used to implement SQLite within the PCL without using Xamarin Forms? This method seems a lot simpler than the abstract class.

like image 630
Tomzie Avatar asked Apr 22 '15 13:04

Tomzie


1 Answers

The SQLite PCL package that is used by the Xamarin Forms example uses SQLite.Net. The Tasky Portable project is using SQLite. The difference is the SQLite.Net is a wrapper over SQLite. You use SQLite.Net as an ORM and not not worry about the implementation details. Instead you can create your POCOs in your PCL and decorate them with the appropriate attributes. The Tasky Portable project is just an older way of doing things in a PCL. Now you have the newer way of doing things with SQLite.Net.

Xamarin Forms is not a prerequisite or co-requisite for using SQLite.Net.

like image 116
Eddie Avatar answered Oct 13 '22 00:10

Eddie