Created
May 22, 2017 21:05
-
-
Save dsibinski/75df037ed90ffab99e5bb313241e8e3c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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