Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Created May 18, 2017 20:47
Show Gist options
  • Save dsibinski/4b8566aba0d8280aa5117de3f1ce70fc to your computer and use it in GitHub Desktop.
Save dsibinski/4b8566aba0d8280aa5117de3f1ce70fc to your computer and use it in GitHub Desktop.
var db = new SQLiteConnection(new SQLitePlatformAndroid(), Constants.DbFilePath);
db.CreateTable<Person>();
db.CreateTable<Event>();
db.CreateTable<PersonEvent>();
var event1 = new Event
{
Name = "Volleyball",
Date = new DateTime(2017, 06, 18),
Place = "Sports hall"
};
var person1 = new Person
{
Name = "A",
LastName = "B",
PhoneNumber = "123456789"
};
db.Insert(person1);
db.Insert(event1);
person1.Events = new List<Event> { event1 };
db.UpdateWithChildren(person1);
var personStored = db.GetWithChildren<Person>(person1.Id);
var eventStored = db.GetWithChildren<Event>(event1.Id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment