private void OnCollectionDeleted(CollectionDeletedPayload payload) { CollectionEntry entry; if (this.TryGetValue(payload.Id, out entry)) { DeleteCollection(entry, Source.Server); this.client.RaiseCollectionDeleted(new CollectionDeletedEventArgs(entry.MasterCollection as SharedCollection, entry.Name)); } else { this.client.RaiseCollectionDeleted(new CollectionDeletedEventArgs(null, payload.Name)); } }
/// <summary> /// Delete the collection from the namespace. Unhook all the local data objects /// </summary> /// <param name="entry"></param> private void DeleteCollection(CollectionEntry entry, Source source) { this.VerifyCollectionConnected(entry); // Alert the server that the collection has been deleted if (source == Source.Client) { // Specify both the name and id since we have this collection mapped into our local client Payload eventData = new CollectionDeletedPayload(entry.Id, this.client.ClientId); client.SendPublishEvent(eventData); } this.Remove(entry.Name); entry.OnDelete(); }
public void Delete(string name) { client.VerifyAccess(); CollectionEntry entry = null; if (this.TryGetValue(name, out entry)) { DeleteCollection(entry, Source.Client); } else { // If we have no local record of a collection it may still exist. Send Delete payload Payload eventData = new CollectionDeletedPayload(name, this.client.ClientId); client.SendPublishEvent(eventData); } }