public void Delete(string name) { ResourceTypeItem item = (ResourceTypeItem)this [name]; IResourceList resList = _storage.GetAllResources(name); resList.DeleteAll(); _resourceTypeCache [item.Id] = null; _resourceTypeNameCache.Remove(name); ICountedResultSet rs = _resourceTypeTable.CreateModifiableResultSet(0, item.Id); try { _storage.SafeDeleteRecord(rs [0], "ResourceTypes.Delete"); } finally { rs.Dispose(); } IResource resourceTypeRes = _storage.FindUniqueResource("ResourceType", "Name", name); Debug.Assert(resourceTypeRes != null); resourceTypeRes.Delete(); }
/** * Unregisters the specified property type and deletes all properties * of that type. */ public void Delete(int id) { PropTypeItem item = FindPropTypeItem(id); if (item.DataType == PropDataType.Link) { _storage.DeleteLinksOfType(id); } else { _storage.DeletePropsOfType(id); } ResourceRestrictions.DeletePropRestrictions(id); IResultSet rs = _propTypeTable.CreateModifiableResultSet(0, id); try { SafeRecordEnumerator enumerator = new SafeRecordEnumerator(rs, "PropTypes.Delete"); using ( enumerator ) { if (!enumerator.MoveNext()) { MyPalStorage.Storage.OnIndexCorruptionDetected("PropTypeCollection.Delete: Attempt to delete non-existing property type " + id); } else { IRecord rec = enumerator.Current; _storage.SafeDeleteRecord(rec, "PropTypes.Delete"); } } } finally { rs.Dispose(); } IResource propTypeRes = _storage.FindUniqueResource("PropType", "ID", id); Debug.Assert(propTypeRes != null); propTypeRes.Delete(); }