Concrete implementations of abstract members do not appear in the DeclaredMemberMaps collections as of 1.9

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.9.2
    • Component/s: Serialization
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Looks like I am having a breaking change in 1.9 up from 1.8.3.

      I have an abstract base class with an “Id” property:
      public abstract string Id

      { get; set; }

      In my standard model, that string is given an ObjectId string representation. However, if I have a model that implements IScenario that Id stays as a unique string representation.

      In 1.9, this abstract Id column does not appear in my concrete type’s DeclaredMemberMaps.

      Example:

      [TestClass]
      public class ModelMapTests
      {
      public abstract class MyBase { public abstract string Id { get; set; }

      }
      public class MyConcrete : MyBase { public override string Id

      { get; set; }

      }

      public class AbstractColumnConvention : IClassMapConvention
      {
      public void Apply(BsonClassMap classMap)
      {
      if(classMap.ClassType == typeof(MyConcrete))

      { Assert.IsTrue(classMap.DeclaredMemberMaps.Any(m => m.MemberName == "Id")); }

      }

      public string Name
      {
      get

      { return "Abstract Column Convention"; }

      }

      }

      [TestMethod]
      public void ConcreteTypeHasAbstractFields()
      {
      var conventions = new ConventionPack();
      conventions.Add(new AbstractColumnConvention());

      ConventionRegistry.Register("My Conventions", conventions, t =>

      { return t.IsAssignableFrom(typeof(MyConcrete)); }

      );

      BsonClassMap.LookupClassMap(typeof(MyConcrete));
      }
      }

      In 1.8.3 Id was found when mapping MyConcrete. In 1.9 it is not found in MyConcrete, which prevents me from mapping things properly (i.e. how I mapped them under 1.8.3).

            Assignee:
            James Kovacs
            Reporter:
            Eli Gassert
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: