public static WindowsPersistence factory(String name) { WindowsPersistence obj = WindowsPersistence.findByName(name); if (obj == null) { obj = new WindowsPersistence(); obj.name = name; } return(obj); }
public void save() { using (LiteDatabase db = WindowsPersistence.getDB()) { // Get customer collection var col = db.GetCollection <WindowsPersistence>(TABLE); if (WindowsPersistence.findByName(this.name) == null) { col.Insert(this); } else { col.Update(this); } col.EnsureIndex(x => x.name, true); } }