-
Notifications
You must be signed in to change notification settings - Fork 2
Track whether relationships have changed #23
Copy link
Copy link
Closed
Labels
Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Relates to the `ITopicRepository` interface or one of its implementations.Priority: 2Status 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: FeatureIntroduces a major area of functionality.Introduces a major area of functionality.
Milestone
Metadata
Metadata
Assignees
Labels
Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Relates to the `ITopicRepository` interface or one of its implementations.Priority: 2Status 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: FeatureIntroduces a major area of functionality.Introduces a major area of functionality.
Problem
Currently, whenever
ITopicRepository.Save()is called, relationships are deleted (e.g., via the@DeleteRelationshipsparameter on theUpdateTopicstored procedure) and then recreated (via thePersistRelationsstored procedure)—even if no relationships were modified.Solution
Ideally, we'd track whether the relationships collection had been modified, as we already do with
AttributeValueCollection.IsDirty(). That way, we can conditionally disable this, which would reduce the number of unnecessary (and expensive) database calls made when doing a recursiveSave()on a large topic graph (e.g., during anImport()with the OnTopic Data Transfer library).Nice to Have
When combined with
AttributeValueCollection.IsDirty(), this would also potentially allow us to bypass theUpdateTopicentirely, which currently passes, at minimum, the full XML for@ExtendedAttributesXml, in order to evaluate if the extended attributes collection has changed.Implementation
NamedTopicCollection.IsDirtyRelatedTopicCollection.IsDirty()RelatedTopicCollection.SetTopic(…, isDirty)SetTopic(…, isDirty)onSqlTopicRepository.Load()NamedTopicCollection.IsDirtyonSqlTopicRepository.Save()Save()if!RelatedTopicCollection.IsDirty()and!AttributeValueCollection.IsDirty()