private void MapProperty(BsonClassMap classMap, PropertyInfo propertyInfo)
{
if (!propertyInfo.CanRead || (!propertyInfo.CanWrite && classMap.ClassType.Namespace != null))
{
// we can't write or it is anonymous...
return;
}
// skip indexers
if (propertyInfo.GetIndexParameters().Length != 0)
{
return;
}
// skip overridden properties (they are already included by the base class)
var getMethodInfo = propertyInfo.GetGetMethod(true);
if (getMethodInfo.IsVirtual && getMethodInfo.GetBaseDefinition().DeclaringType != classMap.ClassType)
{
return;
}
classMap.MapMember(propertyInfo);
}
}