none
Sqlitestore vs Sqlite-net RRS feed

  • Question

  • I couldn’t find much documentation about the Sqlitestore that is used in Mobile Apps, is there any?

    I wanted to know if it supports indexes, like sqlite-net does. And how to do joins (I previously used Sqlite-net Extensions that supports relationships), do I have to use a foreach and for each id read the entity individually (not very performant when there are many entities)? Or do I have to write a sql?

    Just for curiosity, is it possible to use Sqlite-net instead of Sqlitestore with all the offline sync functionality? 

    Thanks!

    Tuesday, July 5, 2016 3:33 AM

Answers

All replies

  • Hello,

    Thank you for posting here!

    I would suggest you, to refer this GIT HUB where you can get sample project for SQLite Store.

    Here is another article which will help you to work for index and joins with SQLite.

    And also you can check this article which will help you to use SQLite-net for mobile apps.

    Reference: http://stackoverflow.com/questions/36085675/azure-mobile-app-offline-sqlite-sync-hanging-on-initialize

    Hope this helps.


    Regards,

    Swikruti

    Disclaimer:

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    If a post answers your question, please click Mark as Answer on that post and Vote as Helpful.

    Tuesday, July 5, 2016 12:42 PM
  • Thanks for your answer! Nice Adrian Hall blog. Couldn't find about the indexes though. And the SQLite-net Github page doesn't say much about using azure mobile apps offline sync support.

    Summing up:

    "On the client, you will need to do the join of the tables yourself. The client does not know about relationships. Each table is independent."

    Good, that is clear. But there is no joining code. Is there something better than this?:

    List<Tag> tags = new List<Tag>();
    foreach (var todoItem in todoItems)
    {
        var tag = await tagsTable.Where (t => t.Id == todoItem.TagId).FirstOrDefault ();
        if(tag != null)
        {
            tags.Add(tag);
        }
    }

    I guess there should be a better way. Using raw sql statements maybe.

    Nevertheless, for Xamarin we have an awesome light weight orm like Sqlite-net, and optionally using Sqlite-net Extensions. It's the one that is recommended officially by Xamarin. It's there, and it would be awesome to just use it. I understood that it is possible to use it with offline sync, but don't really have the time to implement it. If there is an implementation of sqlite-net and mobile apps offline sync already done, please let me know!

    Cheers


    • Edited by Chris7386 Tuesday, July 5, 2016 4:04 PM
    Tuesday, July 5, 2016 2:30 PM
  • You can implement whatever database technology you want on the client. There is an interface that is needed for implementation - IMobileServiceLocalStore.   Underneath, we use SQLitePCL for our store.  There is a definite set of implementation considerations when using other libraries, so a thorough investigation of the official implementation is suggested.  You can find it here:  https://github.com/Azure/azure-mobile-apps-net-client/blob/master/src/Microsoft.WindowsAzure.MobileServices.SQLiteStore/MobileServiceSQLiteStore.cs


    Tuesday, July 5, 2016 3:14 PM
    Moderator