Commit a82f7e6
committed
Merge branch 'feature/MemberAccessor' into develop
Major refactoring of the internal `OnTopic.Internal.Reflection` classes. Previously, these classes relied on the .NET Reflection libraries to dynamically create delegate signatures for properties and methods before getting or setting values. Now, the delegate signature is created by the new `MemberAccessor` class and cached as part of a `TypeAccessorCache`. This promises to improve performance.
As part of this, I significantly refactored the organization and approach to the code. `TypeMemberInfoCollection` has been replaced by `TypeAccessorCache`, `MemberInfoCollection<T>` has been replaced by `TypeAccessor`, and `MemberDispatcher` has been replaced by `MemberAccessor`. This takes a more intuitive top-down approach, where as previously `MemberDispatcher` maintained its own `TypeMemberInfoCollection` cache which complicated the relationship between objects.
I also improved the validation of accessors, thus helping prevent unnecessary conversions, or attempts to set members that can't be set (e.g., by setting `null` to a non-nullable property).
In theory, this is supposed to have a major performance benefit—and, indeed, according to my initial testing directly against the new and old methods, it did. In real-world testing, however, we're not seeing that much benefit. That said, this also isn't any slower, and while it adds some complexity when calculating the delegate signatures, it's also much better organized.
This resolves Issue #90.19 files changed
Lines changed: 2132 additions & 1352 deletions
File tree
- OnTopic.AspNetCore.Mvc
- OnTopic.Tests
- Fixtures
- ViewModels
- OnTopic
- Internal/Reflection
- Mapping
- Reverse
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | | - | |
1467 | | - | |
| 1466 | + | |
| 1467 | + | |
1468 | 1468 | | |
1469 | 1469 | | |
1470 | | - | |
| 1470 | + | |
1471 | 1471 | | |
1472 | 1472 | | |
1473 | 1473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
| 443 | + | |
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
| |||
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
460 | | - | |
| 461 | + | |
| 462 | + | |
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
| |||
0 commit comments