private void ClearRelationshipsAndPartFromPackagePart(PackagePart sourcePackagePart, string relationshipType) { PackageRelationshipCollection relationships = sourcePackagePart.GetRelationshipsByType(relationshipType); foreach (var relationship in relationships.ToList()) { sourcePackagePart.DeleteRelationship(relationship.Id); if (aasxPackage.PartExists(relationship.TargetUri)) { aasxPackage.DeletePart(relationship.TargetUri); } } }
private void ClearRelationshipAndPartFromPackage(string relationshipType, Uri targetUri) { PackageRelationshipCollection relationships = aasxPackage.GetRelationshipsByType(relationshipType); foreach (var relationship in relationships.ToList()) { if (relationship.TargetUri == targetUri) { aasxPackage.DeleteRelationship(relationship.Id); } } if (aasxPackage.PartExists(targetUri)) { aasxPackage.DeletePart(targetUri); } }