Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1826

Class map automapping should support immutable classes with readonly automatic properties

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.1
    • Affects Version/s: 2.3
    • Component/s: Serialization
    • None

      Class map automapping does not map the following class correctly:

      public class ClassWithReadOnlyProperty
      {
          public ClassWithReadOnlyProperty(int x)
          {
              X = x;
          }
      
          public int X { get; }
      }
      

      Note that this is slightly different from properties with private setters, which are already supported:

      public class ClassWithPrivateSetter
      {
          public ClassWithPrivateSetter(int x)
          {
              X = x;
          }
      
          public int X { get; private set; }
      }
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: