Created
March 19, 2017 21:39
-
-
Save dsibinski/c8256dbaaf5970a512062aa3a9fe5ad3 to your computer and use it in GitHub Desktop.
This file contains 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
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