Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Created March 19, 2017 21:39
Show Gist options
  • Save dsibinski/c8256dbaaf5970a512062aa3a9fe5ad3 to your computer and use it in GitHub Desktop.
Save dsibinski/c8256dbaaf5970a512062aa3a9fe5ad3 to your computer and use it in GitHub Desktop.
public class PeopleRepository
{
private SQLiteConnection db = null;
protected static PeopleRepository me;
static PeopleRepository()
{
me = new PeopleRepository();
}
protected PeopleRepository()
{
db = new SQLiteConnection(Constants.DbFilePath);
db.CreateTable<Person>();
}
public static int SavePerson(Person person)
{
me.db.Insert(person);
return person.Id;
}
public static Person GetPerson(int id)
{
return me.db.Get<Person>(p => p.Id == id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment