Skip to content

Commit 3e51b5c

Browse files
committed
Direct mappings must be settable
A feature of the `TopicMappingLibrary` is to detect members whose names and types are the same between the source topic and the target POCO. In these cases, the value is set directly. That's useful, especially, for items like `VersionHistory`—a `List<DateTime>` collection—because the collection shouldn't be _mapped_, but it should be _maintained_. In order to support this, however, the list must be writable as, currently, the mapping library isn't smart enough to identify that it's a collection, determine of the type of collection, and then copy all of the items over. In fact, that defeats the basic nature of the current check (which works for any type, not just collections) and would require far more logic to implement. Given that, for now, we'll suppress the otherwise useful CA2227.
1 parent 578b594 commit 3e51b5c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

OnTopic.Editor.Models/EditingTopicViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public EditingTopicViewModel() : base() {}
3535
/// Provides a collection of <see cref="DateTime"/> instances during which the represented <see cref="Topic"/> was
3636
/// modified.
3737
/// </summary>
38-
public List<DateTime> VersionHistory { get; } = new();
38+
#pragma warning disable CA2227 // Collection properties should be read only
39+
public List<DateTime> VersionHistory { get; set; } = new();
40+
#pragma warning restore CA2227 // Collection properties should be read only
3941

4042
/*==========================================================================================================================
4143
| PROPERTY: DERIVED TOPIC

0 commit comments

Comments
 (0)