-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
C# 9 introduced return type covariance, and that allows us to override properties with more specific types. MongoDB's driver can't serialize such properties at the moment.
Example:
{}
public class Entity { public virtual object SomeProperty { get; set; } }
{{And:}}
{}
public class User : Entity { public override string SomeProperty { get; set; } }
{{The Mongo BSON serializer thinks these are two separate properties, and it throws an exception because there are two properties that map to the same element.}}
(BTW, I'm new here so if I did something wrong with this feature request please let me know){}