Skip to content

Commit

Permalink
Ensure that implicitly dirty attributes are Save()d
Browse files Browse the repository at this point in the history
Previously, the `SqlTopicRepository.Save()` would save an otherwise clean `Topic` if any of its `Attributes` were marked as indexed, even though their corresponding `AttributeDescriptor` marked them as extended. That is correct behavior. The opposite scenario, however, was not being tripped. As a result, attributes reconfigured from extended to indexed storage would not be picked up as part of `Save()` unless the `Topic` was _explicitly_ marked as `IsDirty()`. This fixes that issue, and resolves #73.
  • Loading branch information
JeremyCaney committed Mar 30, 2021
1 parent ed1d124 commit c272e52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OnTopic.Data.Sql/SqlTopicRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ bool persistRelationships
| current command. A more aggressive version of this would wrap much of the below logic in this, but this is just meant
| as a quick fix to reduce the overhead of recursive saves.
\-----------------------------------------------------------------------------------------------------------------------*/
areAttributesDirty = areAttributesDirty || extendedAttributeList.Any(a => a.IsExtendedAttribute == false);
areAttributesDirty =
areAttributesDirty ||
indexedAttributeList.Any(a => a.IsExtendedAttribute == true) ||
extendedAttributeList.Any(a => a.IsExtendedAttribute == false);

var isDirty =
isTopicDirty ||
Expand Down

0 comments on commit c272e52

Please # to comment.