Support for readonly properties/fields that contain instances

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Serialization
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      We are dealing with lots of entities that create instances for contained properties/fields as part of their instantiation like this:

      public List<int> Foo { get; } = new List<int>();
      

      or more generic

      public SomeType Bar { get; } = new SomeType();
      

      The C# driver is able to serialize these properties nicely once we map them explicitly. However, they are considered readonly so deserialization gets skipped and our entities end up with not populated instances.

      In order to solve this, we would suggest to enhance the driver in a way that - similar to SetIgnoreIfNull - one can select to skip the instantiation of a type and populate an existing instance on the target object.

      Let me know your thoughts. I'd be happy to implement that right away if you agree.

            Assignee:
            James Kovacs
            Reporter:
            Daniel Hegener
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: