DependencyService not needed for SQLite anymore?

Hello.

I was looking at the "ToDo" sample app (https://github.com/xamarin/xamarin-forms-samples/tree/master/Todo) and noticed that the SQLiteAsyncConnection is created in the "Core" application and does not use "DependencyService", nor is there an implementation for each platform (Android, iOS, UWP).

Is this the new way to implement SQLite, and when did it change?

Thanks in advance,

Mike

Answers

  • AndyAndy Member ✭✭

    I'm using the Microsoft.data.sqlite Nuget/github library which works with .NET Standard 2.0

  • MichaelLopez.8911MichaelLopez.8911 USUniversity ✭✭
    edited October 2018

    @Andy said:
    I'm using the Microsoft.data.sqlite Nuget/github library which works with .NET Standard 2.0

    I'm using what is instructed at https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/databases, namely the "sqlite-net-pcl" package. If I'm not mistaken I think I tried what you are doing but had problems. Sorry, I can't be more specific as it was a while ago.

    The "ToDo" example also uses the "sqlite-net-pcl" package.

    I wonder what the difference is between the two. In any event, we no longer need to use the DependencyService for instantiating the approriate SQLiteConnection?

  • AndyAndy Member ✭✭

    sqlite-net-pcl is an ORM. If you don't need to be able to generate dynamic queries with dynamic result sets it's fine.
    I you want a lower level SQL interface (ADO.NET like) then you need to do something else.

    What problems did you run into with Microsoft.data.sqlite?

  • MichaelLopez.8911MichaelLopez.8911 USUniversity ✭✭

    @Andy said:
    sqlite-net-pcl is an ORM. If you don't need to be able to generate dynamic queries with dynamic result sets it's fine.
    I you want a lower level SQL interface (ADO.NET like) then you need to do something else.

    What problems did you run into with Microsoft.data.sqlite?

    Like I said, I don't remember specifically. I am used to using the ORM SQLite implementation. Maybe that was it.

    But my question is, we no longer need to use DependencyService with SQLite?

Sign In or Register to comment.