Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Last active August 15, 2018 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/35e5a8990ae1a884c800c304c1d655af to your computer and use it in GitHub Desktop.
Save juucustodio/35e5a8990ae1a884c800c304c1d655af to your computer and use it in GitHub Desktop.
Example of how to implement local database in your Xamarin.Forms applications - http://julianocustodio.com/litedb
using System.Linq;
using LiteDB;
using Xamarin.Forms;
namespace DemoLiteDB
{
public partial class MainPage : ContentPage
{
LiteDatabase _dataBase;
LiteCollection<Customer> Customers;
public MainPage()
{
InitializeComponent();
_dataBase = new LiteDatabase(DependencyService.Get<IHelper>().GetFilePath("Banco.db"));
Customers = _dataBase.GetCollection<Customer>();
ListCustomers.ItemsSource = Customers.FindAll();
BindingContext = this;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment