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

Abstract Id Members are not handled correctly

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.8.3
    • 1.8, 1.8.1, 1.8.2
    • None
    • None

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

      Attachments

        Activity

          People

            sridhar Sridhar Nanjundeswaran
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: