Skip to content

Commit 7b46514

Browse files
committed
Bypass DeleteTopic() if IsNew
While new topics can—and should—be deleted in memory, they cannot—and should not—be deleted in the database, as they don't yet exist in the database. We choose not to throw an exception since this is a rare situation that still permits usage of the in-memory functionality of the `TopicRepository`. This satisfies the `Delete()` conditions of #77.
1 parent bf1c584 commit 7b46514

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

OnTopic/Repositories/TopicRepository.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,9 @@ public override sealed void Delete([ValidatedNotNull]Topic topic, bool isRecursi
611611
/*------------------------------------------------------------------------------------------------------------------------
612612
| Execute core implementation
613613
\-----------------------------------------------------------------------------------------------------------------------*/
614-
DeleteTopic(topic);
614+
if (!topic.IsNew) {
615+
DeleteTopic(topic);
616+
}
615617

616618
/*------------------------------------------------------------------------------------------------------------------------
617619
| Remove from parent

0 commit comments

Comments
 (0)