Commit abfe213
committed
Ensure that
Previously, when deleting items directly via `Clear()`, the `ClearItems()` wouldn't enforce business logic. This is problematic because sometimes properties either a) disallow nulls, or b) must update their internal states when values are set to null. This would be handled when calling `SetValue()` or going directly through the property, but bypassed when calling `Clear()`.
Unfortunately, for `Clear()`, this means checking the business logic for each individual record. As such, instead of just bulk deleting these, we're instead calling `Remove()` for each individual item. This is less performant, but ensures that the business logic is always accounted for. Fortunately, calling `Clear()` on this collection is uncommon; it's far more common to work with individual items via `SetValue()` or, less commonly, `Remove()`.
This update patches that hole, and thus resolves the `Clear()` portion of #79.ClearItems() enforces business logic1 parent 0bccf1f commit abfe213
File tree
1 file changed
+7
-4
lines changed- OnTopic/Collections/Specialized
1 file changed
+7
-4
lines changedLines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
628 | | - | |
629 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
630 | 633 | | |
631 | 634 | | |
632 | | - | |
633 | | - | |
| 635 | + | |
| 636 | + | |
634 | 637 | | |
635 | 638 | | |
636 | 639 | | |
| |||
0 commit comments