Commit f7d36f0
committed
Merge branch 'feature/IsDirty-improvements' into develop
Made multiple improvements to how `IsDirty()` and `MarkDirty()` are handled to make them more intelligent.
Notably, this includes checks to see if the source `Topic` or, where appropriate, target `Topic` `IsNew` to prevent those items from being marked as `!IsDirty`, even if they are explicitly requested to be marked as clean by e.g. a call to `MarkClean()`, `TrackedItem<T>.IsDirty`, or `SetTopic()`. While these scenarios should not occur, this logic helps prevent inadvertently orphaning values that we _know_ have not been saved, either because the source topic itself has not been saved, or because they point to topics that have not been saved. This effects `TrackedCollection<T>` (85c386f, b0787c6, cbd49c1, 6c6a1b5), `TopicRelationshipMultiMap` (85c386f, 34a80cb, 1222bd0, 2cd0c5f, 249d049) and `Topic` (af53497, dc08f2e).
By making it easier to assess whether a `IEnumerable<Topic>` collection has any `IsNew` topics via the new `IEnumerable<Topic>.AnyNew()` extension method (d551442), this helps support the above for `TopicReferenceCollection` and `TopicRelationshipMultiMap`, thus allowing the `MarkClean()` logic to be moved from `ITopicRepository` implementations—such as `SqlTopicRepository`—and into the base `TopicRepository` class, thus centralizing that logic (2dd8e03).
In addition, this updates `Topic` to use `DirtyKeyCollection` (61fe810) and `ITrackDirtyKeys` (e6d15ab) for more granular tracking of _which_ core attributes have been modified (e.g., `Key`, `ContentType`, or `Parent`), which in turn permits `TopicRepository.Save()` to determine if `TopicRepository.Move()` should be called (f5ba7a8), for cases where a saved topic also has a new parent (ebd6d3c). This fixes a bug that was introduced when `ParentID` was removed from `Topic.Attributes`, since there was no longer a way to determine if a `Topic` had been moved within the topic graph without that update being persisted to the database.File tree
10 files changed
+356
-69
lines changed- OnTopic.Data.Sql
- OnTopic.Tests
- OnTopic
- Associations
- Collections/Specialized
- Querying
- Repositories
10 files changed
+356
-69
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | 13 | | |
17 | 14 | | |
18 | 15 | | |
| |||
491 | 488 | | |
492 | 489 | | |
493 | 490 | | |
494 | | - | |
| 491 | + | |
495 | 492 | | |
496 | 493 | | |
497 | 494 | | |
498 | 495 | | |
499 | 496 | | |
500 | 497 | | |
501 | | - | |
502 | | - | |
503 | 498 | | |
504 | 499 | | |
505 | 500 | | |
| |||
617 | 612 | | |
618 | 613 | | |
619 | 614 | | |
620 | | - | |
| 615 | + | |
621 | 616 | | |
622 | 617 | | |
623 | 618 | | |
624 | 619 | | |
625 | 620 | | |
626 | 621 | | |
627 | | - | |
| 622 | + | |
628 | 623 | | |
629 | 624 | | |
630 | 625 | | |
| |||
641 | 636 | | |
642 | 637 | | |
643 | 638 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | 639 | | |
649 | 640 | | |
650 | 641 | | |
651 | 642 | | |
652 | 643 | | |
653 | | - | |
654 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
655 | 648 | | |
656 | 649 | | |
657 | 650 | | |
658 | | - | |
| 651 | + | |
659 | 652 | | |
660 | 653 | | |
661 | 654 | | |
662 | 655 | | |
663 | 656 | | |
664 | 657 | | |
665 | 658 | | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | 659 | | |
672 | 660 | | |
673 | 661 | | |
| |||
704 | 692 | | |
705 | 693 | | |
706 | 694 | | |
707 | | - | |
708 | 695 | | |
709 | 696 | | |
710 | 697 | | |
711 | 698 | | |
712 | 699 | | |
713 | | - | |
714 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
715 | 704 | | |
716 | 705 | | |
717 | 706 | | |
718 | | - | |
| 707 | + | |
719 | 708 | | |
720 | 709 | | |
721 | 710 | | |
722 | 711 | | |
723 | 712 | | |
724 | 713 | | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | 714 | | |
731 | 715 | | |
732 | 716 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
| 424 | + | |
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
| 470 | + | |
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
479 | 525 | | |
480 | 526 | | |
481 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
59 | | - | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
113 | 135 | | |
114 | 136 | | |
115 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
339 | 383 | | |
340 | 384 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
| 400 | + | |
| 401 | + | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | | - | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
249 | 259 | | |
250 | 260 | | |
251 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
252 | 269 | | |
253 | 270 | | |
254 | 271 | | |
0 commit comments