-
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
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
}
public class AbstractColumnConvention : IClassMapConvention
{
public void Apply(BsonClassMap classMap)
{
if(classMap.ClassType == typeof(MyConcrete))
}
public string Name
{
get
}
}
[TestMethod]
public void ConcreteTypeHasAbstractFields()
{
var conventions = new ConventionPack();
conventions.Add(new AbstractColumnConvention());
ConventionRegistry.Register("My Conventions", conventions, t =>
);
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).