Commit c035ca0
committed
Exclude empty values from
Previously, `GetAttributes()` would return all attributes that met its criteria—even if their value was `null` or empty. In practice, however, `null` or empty attributes should be treated as deletions.
The `UpdateTopic` stored procedure takes care of this scenario for _indexed_ attributes, but it introduces a problem for the _extended_ attributes. When an attribute is first deleted, the `Save()` will generate an empty attribute container for it. The next time the application `Load()`s, that attribute container will be discarded by the **OnTopic Library**. As such, if it's `Save()`d again, that attribute container will be removed.
That process is largely transparent, and doesn't really hurt anything. But it does introduce some noise to the `ExtendedAttributes` table by introducing versions which might only vary by the introduction of an empty attribute—and especially now that `UpdateTopic` would otherwise eliminate consecutive duplicates. To prevent this, and to avoid confusion, `null` or empty attributes are now filtered out of `GetAttributes()` entirely so there's no risk of them polluting _any_ downstream providers, not just `SqlTopicRepository`.
While this issue was exposed by the deduplication of consecutive versions code, it became even more noticeable when testing the Programmatic Support for Arbitrary Attributes (#19), since that introduces scenarios where values may be removed from the _extended_ attributes and added to the _indexed_ attributes (if their length is below 255), which would not only introduce this empty value in the _extended_ attribute storage, but also introduce ambiguity in the data model since different attribute values would be defined in two places for the same version (similar to 7a61005). This mitigates that redundancy and ambiguity.GetAttributes()
1 parent 7a61005 commit c035ca0
2 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
71 | 94 | | |
72 | 95 | | |
73 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
505 | 511 | | |
506 | 512 | | |
507 | 513 | | |
| |||
0 commit comments