Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Last active May 21, 2017 10:17
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/c04bd7030750a87ab3898621612eca03 to your computer and use it in GitHub Desktop.
Save dsibinski/c04bd7030750a87ab3898621612eca03 to your computer and use it in GitHub Desktop.
var db = new SQLiteConnection(new SQLitePlatformAndroid(), Constants.DbFilePath);
db.CreateTable<Vehicle>();
db.CreateTable<RegistrationCertificate>();
var vehicle = new Vehicle
{
Brand = "Renault",
EngineCapacity = 1.9m,
ProductionDate = new DateTime(2001, 01, 01)
};
var certificate = new RegistrationCertificate
{
RegistrationNumber = "AB 12345",
OwnerData = "Dawid Sibiński",
VIN = "1312BS1312ASDSSVVW"
};
db.Insert(vehicle);
db.Insert(certificate);
vehicle.RegistrationCertificate = certificate;
db.UpdateWithChildren(vehicle);
var vehicleStored = db.GetWithChildren<Vehicle>(vehicle.Id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment