Class InheritanceMappingAttribute
Defines to which type linq2db should map record based on discriminator value. You can apply this attribute to a base class or insterface, implemented by all child classes. Don't forget to define discriminator value storage column using IsDiscriminator.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true)]
public class InheritanceMappingAttribute : MappingAttribute, _Attribute
- Inheritance
-
InheritanceMappingAttribute
- Implements
- Inherited Members
- Extension Methods
Remarks
You cannot configure inheritance mapping using this attribute for discriminator types, not supported by .NET attributes. See document for a list of supported types.
Properties
Code
Gets or sets discriminator value.
public object? Code { get; set; }
Property Value
IsDefault
Get or sets flag, that tells linq2db that current mapping should be used by default if suitable mapping type not found.
public bool IsDefault { get; set; }
Property Value
Type
Gets or sets type, to which record with current discriminator value should be mapped.
public Type Type { get; set; }
Property Value
Methods
GetObjectID()
Returns mapping attribute id, based on all attribute options.
public override string GetObjectID()