Skip to content

Track whether relationships have changed #23

@JeremyCaney

Description

@JeremyCaney

Problem

Currently, whenever ITopicRepository.Save() is called, relationships are deleted (e.g., via the @DeleteRelationships parameter on the UpdateTopic stored procedure) and then recreated (via the PersistRelations stored 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 recursive Save() on a large topic graph (e.g., during an Import() with the OnTopic Data Transfer library).

Nice to Have

When combined with AttributeValueCollection.IsDirty(), this would also potentially allow us to bypass the UpdateTopic entirely, which currently passes, at minimum, the full XML for @ExtendedAttributesXml, in order to evaluate if the extended attributes collection has changed.

Implementation

  • NamedTopicCollection.IsDirty
  • RelatedTopicCollection.IsDirty()
  • RelatedTopicCollection.SetTopic(…, isDirty)
  • Call SetTopic(…, isDirty) on SqlTopicRepository.Load()
  • Disable NamedTopicCollection.IsDirty on SqlTopicRepository.Save()
  • Bypass Save() if !RelatedTopicCollection.IsDirty() and !AttributeValueCollection.IsDirty()

Metadata

Metadata

Assignees

Labels

Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Priority: 2Status 5: CompleteTask is considered complete, and ready for deployment.Type: FeatureIntroduces a major area of functionality.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions