Skip to content

Commit bc0c1c7

Browse files
committed
Conditionally call PersistRelations()
Currently, every time `UpdateTopic` is called, `@DeleteRelationships` is called, and then all relationships are resaved via `PersisRelations()`. This adds unnecessary overhead when references aren't all resolved, as we know we're going to have to call `Save()` on those topics _again_ once the topic graph has been saved. To reduce this overhead, we're now conditionally calling `PersistRelations()` based on the `areReferencesResolved` flag. _Note:_ The `@DeleteRelationships` parameter is also conditionally set based on this—but that was inadvertantly committed as part of a previous commit (0c860ae). Whoops! Future readers: I apologize or the messy commit history.
1 parent b3aca78 commit bc0c1c7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ void addUnmatchedAttribute(string key) {
466466
"The call to the CreateTopic stored procedure did not return the expected 'Id' parameter."
467467
);
468468

469-
PersistRelations(topic, connection, true);
469+
if (areReferencesResolved) {
470+
PersistRelations(topic, connection, true);
471+
}
470472

471473
topic.VersionHistory.Insert(0, version.Value);
472474

0 commit comments

Comments
 (0)