O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing data with SQLite.NET

Many apps need to use databases, whether the app is database-centric or even just to store pieces of data in a structured form. A lightweight ORM can be used to make data access easier.

How to do it...

Accessing the database is very easy when using SQLite.NET, especially since we don't have to write a single line of SQL. Let's take a look at the following steps:

  1. Before we can make use of SQLite.NET, we need to add the component. Right-click on the Components folder in the project and click on Get More Components…. In the dialog that appears, we search for and add the SQLite.NET component.
  2. Once the component is downloaded, we can start creating the C# types that will represent the tables:
    public class MyTable { [AutoIncrement, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required