Commit c3c01ef
committed
Support saving arbitrary attributes
When an `ITopicRepository` implementation calls `GetAttributes()`, they will now receive arbitrary attributes—i.e., attributes that aren't specified in the `ContentTypeDescriptor` schema, but are defined in the `AttributeValueCollection`. This allows those arbitrary values to be programmatically defined and `Save()`d using the **OnTopic Library**. Previously, this functionality was exclusively available via the SQL database.
Arbitrary attributes present some ambiguity. One source of ambiguity is whether they should be stored as _indexed_ or _extended_ attributes. Currently, most arbitrary attributes defined in the database are stored as _indexed_ attributes, which are easier to update and lookup via SQL. They also tend to be short, so this is an optimal format for them. That said, an arbitrary attribute _could_ be longer than 255—the limit for indexed attributes.
Given this, the `GetAttributes()` will return an arbitrary attribute as _indexed_ if the length is 255 characters or less, and as _extended_ if it's greater than 255 characters. As part of this, I've also made the condtion for returning an attribute more concise.
Finally, this includes a couple of unit tests for validating that arbitrary values are correctly being returned as either indexed or extended attributes via `GetAttributes()`.
This supports Programmatic Support for Arbitrary Attributes (#19)1 parent fb3366e commit c3c01ef
2 files changed
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
109 | 151 | | |
110 | 152 | | |
111 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
506 | 509 | | |
507 | 510 | | |
508 | 511 | | |
| |||
0 commit comments