[CSHARP-803] Abstract Id Members are not handled correctly Created: 14/Aug/13  Updated: 25/Aug/15  Resolved: 21/Aug/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.8, 1.8.1, 1.8.2
Fix Version/s: 1.8.3

Type: Bug Priority: Major - P3
Reporter: Craig Wilson Assignee: Sridhar Nanjundeswaran
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

The below NUnit test will throw the error. The NamedIdMemberFinderConvention should not be mapping overridden members.

[TestFixture]
public class AbstractIdInBaseClassTests
{
    private abstract class BaseClass
    {
        public abstract int Id { get; set; }
    }
 
    private class Impl : BaseClass
    {
        public override int Id { get; set; }
    }
 
    [Test]
    public void TestSerialization()
    {
        var impl = new Impl { Id = 1 };
 
        var doc = impl.ToBsonDocument();
 
        var expected = new BsonDocument("_id", 1);
        Assert.AreEqual(expected, doc);
    }
}



 Comments   
Comment by auto [ 25/Sep/13 ]

Author:

{u'username': u'sridharn', u'name': u'Sridhar Nanjundeswaran', u'email': u'sridhar@10gen.com'}

Message: CSHARP-803 - Ignore overriden id members when applying NamedIdMemberConvention
Branch: v1.8.3
https://github.com/mongodb/mongo-csharp-driver/commit/de66bed54f94083ff2905f1a0e728816ac2e1ed3

Comment by auto [ 21/Aug/13 ]

Author:

{u'username': u'sridharn', u'name': u'Sridhar Nanjundeswaran', u'email': u'sridhar@10gen.com'}

Message: CSHARP-803 - Ignore overriden id members when applying NamedIdMemberConvention
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/aa991d9686f7c949b1f8ef4e75387ee63100e85c

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