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

Abstract Id Members are not handled correctly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.8.3
    • Affects Version/s: 1.8, 1.8.1, 1.8.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

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

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

              Created:
              Updated:
              Resolved: