Exemplo n.º 1
0
        public static WindowsPersistence factory(String name)
        {
            WindowsPersistence obj = WindowsPersistence.findByName(name);

            if (obj == null)
            {
                obj      = new WindowsPersistence();
                obj.name = name;
            }
            return(obj);
        }
Exemplo n.º 2
0
        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);
            }
        }