Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Created May 22, 2017 21:05
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 dsibinski/75df037ed90ffab99e5bb313241e8e3c to your computer and use it in GitHub Desktop.
Save dsibinski/75df037ed90ffab99e5bb313241e8e3c to your computer and use it in GitHub Desktop.
var db = new SQLiteConnection(new SQLitePlatformAndroid(), Constants.DbFilePath);
db.CreateTable<Employee>();
db.CreateTable<Duty>();
var employee = new Employee
{
Name = "Andrew",
LastName = "Programmer"
};
var duty1 = new Duty()
{
Description = "Project A Management",
Deadline = new DateTime(2017, 10, 31)
};
var duty2 = new Duty()
{
Description = "Reporting work time",
Deadline = new DateTime(2022, 12, 31)
};
db.Insert(employee);
db.Insert(duty1);
db.Insert(duty2);
employee.Duties = new List<Duty> {duty1, duty2};
db.UpdateWithChildren(employee);
var employeeStored = db.GetWithChildren<Employee>(employee.Id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment