SQLite & PCL

LeeMallonLeeMallon GBInsider, University ✭✭


Is there a way to use SQLite in a PCL or is this still the best workaround http://stackoverflow.com/questions/13699544/using-sqlite-inside-portable-class-library




  • SKallSKall USMember ✭✭✭✭

    Try SQLite.Net.Async from NuGet.

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    SQlite should be PCL compatible already. Data in mobile should show how you can achieve a cross-platform implementation.

  • LeeMallonLeeMallon GBInsider, University ✭✭

    thanks @SKall‌, I will check it out

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I'm using Sqlite.Net from Nuget here inside a PCL and all you have do to is to provide a platform specific connection. Verified on Android and iOS - I have not tested WP8.

  • SKallSKall USMember ✭✭✭✭

    WP8 works too.

  • ChristiaanJPvanWykChristiaanJPvanWyk ZABeta, University, Developer Group Leader ✭✭

    Hi @LeeMallon‌

    We look at SQLite.Net in XAM160 - Data in Mobile, but we look specifically at SQLite.Net with PCL and dependency injection as well as platform extensions in XAM300 - Advanced Cross-Platform development.

    If you want to explore last mentioned, have a look at the following Nuget packages:

    SQLite.Net PCL & SQLite.Net.Async PCL

    There are now Platform specific packages available to use in conjunction with these for each of the following platforms:

    Win32 Platform, XamarinIOS Platform, XamarinAndroid Platform, WinRT Platform & WindowsPhone8 Platform

    Hope this helps

  • tshealtsheal GBMember, University
    edited March 2014

    If you get onboard with MVVMCross, then there is a great SQLite plugin which is cross platform. In the PCL you can write all your models and logic, and then simply call

    ISQLiteConnection connection = Mvx.ResolveI<SQLiteConnection>();

    to call methods in the platform specific implementation.

  • AlecTucker.2208AlecTucker.2208 AUInsider, University, Developer Group Leader mod

    I can second what Tristan (whose face looks kinda familiar) says - the MvvmCross NuGet package works very nicely.

Sign In or Register to comment.