-
Notifications
You must be signed in to change notification settings - Fork 2
Handle attribute configuration mismatch on Save() #24
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: 2Severity 0: Nice to haveStatus 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: BugBehavior that is inconsistent with documented or expected behavior.Behavior that is inconsistent with documented or expected behavior.
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: 2Severity 0: Nice to haveStatus 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: BugBehavior that is inconsistent with documented or expected behavior.Behavior that is inconsistent with documented or expected behavior.
Background
Currently, when calling
ITopicRepository.Save()—and especiallySqlTopicRepository.Save()—all attributes flagged asAttributeDescriptor.IsExtendedAttributeare sent to theUpdateTopicstored procedure's@ExtendedAttributesXmlparameter, but onlyAttributeValue.IsDirtyattributes are sent via the@Attributesparameter.Problem
This introduces a wrinkle when supporting moved attributes—i.e., attribute values that haven't changed, but whose storage location has been reconfigured via
AttributeDescriptor.IsExtendedAttributesince theTopicwas lastSave()d. This can potentially result in data loss, since theExtendedAttributesXmlis always saved (thus deleting the attribute from theIsExtendedAttributestore), but only changed attributes are stored in the indexed attribute store.Solution
To handle this, we should ideally factor in configuration mismatches as part of
Save(). This would require tracking where attributes came from (e.g., via aAttributeValue.IsExtendedAttributeproperty) so that we can detect mismatches with the configuration (via theAttributeDescriptor.IsExtendedAttributeproperty). Then, any mismatched attributes would be sent to their respective store, regardless of whether or not they have been changed (i.e., independent ofIsDirty()).Implementation
AttributeValue.IsExtendedAttributeAttributeValueCollection.SetValue(…, isExtendedAttribute)SetValue(…, isExtendedAttribute)fromSqlTopicRepository.Load()TopicRepositoryBase.IsExtendedAttributeMismatch()IsExtendedAttributeMismatch()intoGetAttributes()IsExtendedAttributeMismatch()intoSave()