Last active
August 15, 2018 16:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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