public static void Delete(string name) { ObjectStore os = ObjectStore.FetchByColumn(ObjectStore.Columns.Name, name); ObjectStore.Destroy(os.Id); ZCache.RemoveCache("object-" + name); }
public static void RemoveFeedData() { ObjectStoreCollection osc = new ObjectStoreCollection(); Query q = ObjectStore.CreateQuery(); q.AndWhere(ObjectStore.Columns.ContentType, "feed/xml"); osc.LoadAndCloseReader(q.ExecuteReader()); foreach (ObjectStore os in osc) { ObjectStore.Destroy(os.Id); } ZCache.RemoveCache("Feed-Objects"); }
/// <summary> /// Deletes a widget. /// </summary> /// <param name="id"></param> public static void Delete(string id) { Query q = ObjectStore.CreateQuery(); q.AndWhere(ObjectStore.Columns.Name, id); q.AndWhere(ObjectStore.Columns.ContentType, "xml/widget"); ObjectStoreCollection osc = new ObjectStoreCollection(); osc.LoadAndCloseReader(q.ExecuteReader()); if (osc.Count > 1) { throw new Exception("More than one item matched id/name "); } else if (osc.Count > 0) { ObjectStore.Destroy(osc[0].Id); } Reset(); }