/// <summary> /// Called when [deleting]. /// </summary> protected override void OnDeleting() { base.OnDeleting(); CatalogRelationDto catalogRelationDto = CatalogContext.Current.GetCatalogRelationDto(PrimaryKeyId.ToString()); if (catalogRelationDto.CatalogItemAsset.Count > 0) { for (int i = 0; i < catalogRelationDto.CatalogItemAsset.Count; i++) { catalogRelationDto.CatalogItemAsset[i].Delete(); } if (catalogRelationDto.HasChanges()) { CatalogContext.Current.SaveCatalogRelationDto(catalogRelationDto); } } // Clean Up BlobStorage BlobStorageProvider provider = BlobStorage.Providers[BlobStorageProvider]; if (provider != null) { BlobInfo blobInfo = provider.GetInfo((Guid)BlobUid); if (blobInfo != null) { provider.ReleaseStream(blobInfo); } } }