I'm having problems with mapping some classes using BsonClassMap. I've 3 classes like this:
abstract class A {
public string FirstName { get; set; }
}
abstract class B : A{
public string LastName { get; set; }
}
class C : B {
public int Age { get; set; }
}
I want only properties visible in the class C to be mapped to database.
BsonClassMap.RegisterClassMap<C>(map =>
{
map.MapProperty(c => c.FirstName).SetElementName("fn");
map.MapProperty(c => c.LastName).SetElementName("ln");
map.MapProperty(c => c.Age).SetElementName("age");
});
This throws an exception and from what I've manage to find out it seems to be because the properties don't belong to the C class. How should i map this kind of structure ?