Skip to content

Instantly share code, notes, and snippets.

View dsibinski's full-sized avatar

Dawid Sibiński dsibinski

View GitHub Profile
public class PersonEvent
{
[ForeignKey(typeof(Person))]
public int PersonId { get; set; }
[ForeignKey(typeof(Event))]
public int EventId { get; set; }
}
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"
[Table("RegistrationCertificates")]
public class RegistrationCertificate
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string RegistrationNumber { get; set; }
public string VIN { get; set; }
[Table("Vehicles")]
public class Vehicle
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Brand { get; set; }
public DateTime ProductionDate { get; set; }
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)
};
[Table("RegistrationCertificates")]
public class RegistrationCertificate
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string RegistrationNumber { get; set; }
public string VIN { get; set; }
[Table("Employees")]
public class Employee
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
public string LastName { get; set; }
[OneToMany]
[Table("Duties")]
public class Duty
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Description { get; set; }
public DateTime Deadline { get; set; }
var db = new SQLiteConnection(new SQLitePlatformAndroid(), Constants.DbFilePath);
db.CreateTable<Employee>();
db.CreateTable<Duty>();
var employee = new Employee
{
Name = "Andrew",
LastName = "Programmer"
};
[Table("Duties")]
public class Duty
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Description { get; set; }
public DateTime Deadline { get; set; }