[CSHARP-1826] Class map automapping should support immutable classes with readonly automatic properties Created: 14/Nov/16  Updated: 19/Dec/16  Resolved: 19/Dec/16

Status: Closed
Project: C# Driver
Component/s: Serialization
Affects Version/s: 2.3
Fix Version/s: 2.4.1

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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; }
}



 Comments   
Comment by Githook User [ 19/Dec/16 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1826: Map immutable classes correctly.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/f7ca6aa7a6778f20bd2fbad20e3cc918f5481f65

Generated at Wed Feb 07 21:40:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.