Commit 7a5a243
committed
Introduced new
Previously, the `GetContentTypeDescriptors()` method _exclusively_ relied on retrieving the content type descriptors from the underlying data storage of the concrete implementation. This makes good sense in most read-optimized scenarios, where the metadata schema is well-established.
This introduces problems, however, when trying to persist large, in-memory topic graphs to the storage medium. In those cases, we may need to dynamically update the `GetContentTypeDescriptors()` cache with as-of-yet-unsaved `ContentTypeDescriptor`s in order to bootstrap the database. For example, imagine trying to save the `Root` topic (a `Container` content type) before the `Container` content type descriptor has been persisted to the database.
While this update doesn't support that functionality, it lays the groundwork by allowing implementers to pass an in-memory `ContentTypeDescriptor` to the `GetContentTypeDescriptors()` and either a) use that _instead_ of the data source (potentially useful for bootstrapping the database), or b) merge new `ContentTypeDesciptor`s with the existing cached data (potentially useful when importing large changes, as needed for the **OnTopic Data Exchange** library).
The logic for this largely repeats the existing logic for `GetContentTypeDescriptors()`, so its been modified to load the topic graph from the underlying data source, and then pass it to this new overload as to keep that logic centralized. In this way, this overload maintains existing functionality, while providing additional flexibility for implementers.
This will also lay the groundwork for the newly proposed features:
- Update content type cache when adding or removing content types (#16),
- Update attribute descriptors when adding or removing an attribute (#17), and
- Discover in-memory `ContentTypeDescriptor`, `AttributeDescriptor` on `Save()` (#18).
Includes a unit test to validate the ability to merge new in-memory `ContentTypeDescriptor`s into the `GetContentTypeDescriptors()` cache.GetContentTypeDescriptors() overload1 parent 6f825f5 commit 7a5a243
3 files changed
Lines changed: 88 additions & 17 deletions
File tree
- OnTopic.TestDoubles
- OnTopic.Tests
- OnTopic/Repositories
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
149 | 171 | | |
150 | 172 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 70 | + | |
75 | 71 | | |
76 | | - | |
| 72 | + | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
93 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
94 | 119 | | |
95 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
96 | 138 | | |
97 | 139 | | |
98 | 140 | | |
| |||
0 commit comments