Commit 78e5536
committed
Merge branch 'improvement/ItemConfiguration-refactoring' into develop
Refactored the `ItemConfiguration` class to be a property of `ItemMetadata`. Since the vast majority of the properties on `ItemConfiguration` don't change at runtime (since they map to `[Attribute]` values), it makes sense to evaluate them once and then cache them with their corresponding `ItemMetadata` instance. This also allows us to "flip the script" on how we pass metadata within the mapping services: Previously, we passed an `ItemConfiguration` (or `PropertyConfiguration`) instance, through which recipients could access the `ItemMetadata` (or `PropertyAccessor`); now, the `ItemMetadata` (or `PropertyAccessor`) is relayed within the mapping services, through which recipients can access the `ItemConfiguration` property. In practice, this is a more intuitive data model, and should be faster.
The one element of `ItemConfiguration` that did change at runtime was the `attributePrefix`, which was previously factored into the `ItemConfiguration.AttributeKey` property. Since this can't be factored into the cached `ItemMetadata.Configuration` reference, it must be relayed independently within the mapping services. This has been added to most of the method signatures within `TopicMappingService` and `ReverseTopicMappingService` (and its dependent `BindingModelValidator`). Further, a new `GetCompositeAttributeKey()` convenience method was introduced to centralize how the concatenation of the `attributePrefix` and `AttributeKey` should work.
Finally, this allowed us to remove the `PropertyConfiguration` entirely. The one remaining dependency on it—the `Validate` method—has been moved to `MemberAccessor`.8 files changed
Lines changed: 237 additions & 228 deletions
File tree
- OnTopic.AspNetCore.Mvc.Tests
- OnTopic
- Internal/Reflection
- Mapping
- Internal
- Reverse
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
105 | 129 | | |
106 | 130 | | |
107 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
221 | 236 | | |
222 | 237 | | |
223 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 34 | | |
39 | 35 | | |
40 | 36 | | |
| |||
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 47 | + | |
54 | 48 | | |
55 | 49 | | |
56 | 50 | | |
57 | 51 | | |
58 | | - | |
59 | 52 | | |
60 | 53 | | |
61 | 54 | | |
62 | 55 | | |
63 | 56 | | |
64 | | - | |
65 | | - | |
| 57 | + | |
| 58 | + | |
66 | 59 | | |
67 | 60 | | |
68 | 61 | | |
| |||
79 | 72 | | |
80 | 73 | | |
81 | 74 | | |
82 | | - | |
| 75 | + | |
83 | 76 | | |
84 | | - | |
| 77 | + | |
85 | 78 | | |
86 | 79 | | |
87 | 80 | | |
| |||
114 | 107 | | |
115 | 108 | | |
116 | 109 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 110 | | |
126 | 111 | | |
127 | 112 | | |
| |||
433 | 418 | | |
434 | 419 | | |
435 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| |||
This file was deleted.
0 commit comments