-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.10.2
-
Component/s: Serialization
-
None
-
Environment:Windows
-
None
-
None
-
None
-
None
-
None
-
None
-
None
[BsonDiscriminator(RootClass = true)]
[BsonKnownTypes(typeof(Apple))]
[BsonIgnoreExtraElements]
public abstract class Fruit {
[BsonIgnore]
public abstract string Color { get; }
}
[BsonIgnoreExtraElements]
public class Apple : Fruit
{
[BsonConstructor]
public Apple( int seeds ) {
Seeds = seeds;
}
public int Seeds { get; }
[BsonIgnore]
public override string Color => "Red";
}
Throws exception:
BsonSerializationException : Member 'Seeds' is not mapped.
The same occurs if we use a hardcoded base constructor argument instead of an abstract property
[BsonConstructor] public Apple(int seeds) : base ( color: "Red" ) { Seeds = seeds; }
- duplicates
-
CSHARP-3240 ImmutableTypeClassMapConvention is ignoring some constructors
-
- Closed
-