It's all in the links you posted. The InheritanceMappingAttribute
class maps an inheritance hierarchy to LINQ
to SQL
application.
The InheritanceMappingAttribute()
constructor initializes a new instance of class InheritanceMappingAttribute
.
Properties
-
Code
: Gets or sets the value of the discriminator code in a mapped inheritance hierarchy.
-
IsDefault
: Gets or sets if an object of this type is instantiated when the discriminator value does not match a specified value.
-
Type
: Gets or sets the type of class in the hierarchy.
-
TypeId
: When implemented in a derived class, gets a unique identifier for this Attribute
. (inherited from Attribute.)
When mapping inheritance hierarchies, note the following:
-
All classes in a hierarchy should be mapped to a single table.
-
The table for an inheritance hierarchy must be declared in the mapped type that is at the top of the hierarchy. You can not specify table mapping attributes in a class that is derived from the top class.
-
You can use an interface in a hierarchy, but LINQ is not mapped.
-
You can ignore a class in the hierarchy when mapping classes, but you can only query mapped classes.
For the correct materialization, discriminator code values must be unique and match the values in the database. A line with a discriminator code value exactly matches (even by case) an instance of the class using IsDefault
set to true
.
On the IsDiscriminator
property, it gets or sets whether a column contains a discriminator value for a LINQ
to SQL
inheritance hierarchy. The default is false
.
When you use true
, this property identifies the member of the class that contains the discriminator value for an inheritance hierarchy.
Sample Documentation :
[Column(Storage="_Title", DbType="NVarChar(30)",IsDiscriminator=true)]
public string Title
{
get
{
return this._Title;
}
set
{
if ((this._Title != value))
{
this.OnTitleChanging(value);
this.SendPropertyChanging();
this._Title = value;
this.SendPropertyChanged("Title");
this.OnTitleChanged();
}
}
}
About the Shape class: see these two links from the documentation: Class Shape and ShapeType .