Skip to content

Bug: TopicRepository.Delete() throws exception if topic references are present #47

@JeremyCaney

Description

@JeremyCaney

When calling ITopicRepository.Delete(), any topic references on the current or descendent topics should be deleted as part of the operation. While this will be done by e.g. the DeleteTopic stored procedure (if using the SqlTopicRepository), this should also be done in the in-memory topic graph in order to ensure that any topics they are pointing to no longer maintain a reference to the deleted topics via IncomingRelationships. There is already logic in place to handle this, but it throws an exception.

Cause

The Delete() method loops through all items in the Topic.References collection, and removes them, thus not only removing them from the current collection, but also any IncomingRelationships that point back to the current topic. By removing them, however, the collection being iterated against is modified, resulting in an exception being thrown.

Metadata

Metadata

Assignees

Labels

Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Priority: 0Severity 2: MajorStatus 5: CompleteTask is considered complete, and ready for deployment.Type: BugBehavior that is inconsistent with documented or expected behavior.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions