Class DerivedTypeDiscriminatorConvention
Represents a MongoDB discriminator convention for handling types that have DerivedTypeAttribute.
public class DerivedTypeDiscriminatorConvention : IDiscriminatorConvention
- Inheritance
-
DerivedTypeDiscriminatorConvention
- Implements
-
IDiscriminatorConvention
- Inherited Members
Remarks
Initializes a new instance of the DerivedTypeDiscriminatorConvention class.
Constructors
DerivedTypeDiscriminatorConvention(IDerivedTypes)
Represents a MongoDB discriminator convention for handling types that have DerivedTypeAttribute.
public DerivedTypeDiscriminatorConvention(IDerivedTypes derivedTypes)
Parameters
derivedTypesIDerivedTypesIDerivedTypes in the system.
Remarks
Initializes a new instance of the DerivedTypeDiscriminatorConvention class.
Fields
PropertyName
The name of the property used by serializer as a discriminator.
public const string PropertyName = "_derivedTypeId"
Field Value
Properties
ElementName
Gets the discriminator element name.
public string ElementName { get; }
Property Value
Methods
GetActualType(IBsonReader, Type)
Gets the actual type of an object by reading the discriminator from a BsonReader.
public Type GetActualType(IBsonReader bsonReader, Type nominalType)
Parameters
bsonReaderIBsonReaderThe reader.
nominalTypeTypeThe nominal type.
Returns
- Type
The actual type.
GetDiscriminator(Type, Type)
Gets the discriminator value for an actual type.
public BsonValue GetDiscriminator(Type nominalType, Type actualType)
Parameters
Returns
- BsonValue
The discriminator value.