Details
-
Bug
-
Resolution: Duplicate
-
Major - P3
-
None
-
2.10.2
-
None
-
Windows
Description
[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;
|
}
|
Attachments
Issue Links
- duplicates
-
CSHARP-3240 ImmutableTypeClassMapConvention is ignoring some constructors
-
- Closed
-