/
InheritanceMappingAttribute.xml
195 lines (177 loc) · 11.8 KB
/
InheritanceMappingAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<Type Name="InheritanceMappingAttribute" FullName="System.Data.Linq.Mapping.InheritanceMappingAttribute">
<TypeSignature Language="C#" Value="public sealed class InheritanceMappingAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit InheritanceMappingAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.Data.Linq.Mapping.InheritanceMappingAttribute" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class InheritanceMappingAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type InheritanceMappingAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class InheritanceMappingAttribute sealed : Attribute" />
<AssemblyInfo>
<AssemblyName>System.Data.Linq</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=false)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=false)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Maps an inheritance hierarchy in a LINQ to SQL application.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
One <xref:System.Data.Linq.Mapping.InheritanceMappingAttribute> is specified per mapped class.
Note the following when you map inheritance hierarchies:
- All classes in a hierarchy must be mapped to a single table.
- The table for an inheritance hierarchy must be declared on the mapped type that is at the top of the hierarchy. You cannot specify the table or mapping attributes in a class that is derived from the top class.
- You can use an interface in a hierarchy, but LINQ does not map it.
- You can skip a class in the hierarchy when you map classes, but you can query against mapped classes only.
For correct materialization, discriminator code values must be unique and match the values in the database. A row with a discriminator code value that does not exactly match (even by casing) instantiates the class by using <xref:System.Data.Linq.Mapping.InheritanceMappingAttribute.IsDefault%2A> set to `true`.
## Examples
This example shows inheritance mapping for a hierarchy where the top, mapped class (`Shape`) is abstract.
:::code language="csharp" source="~/snippets/csharp/System.Data.Linq.Mapping/InheritanceMappingAttribute/Overview/Program.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Data.Linq.Mapping.InheritanceMappingAttribute/vb/Module1.vb" id="Snippet1":::
The following example shows the inclusion of unmapped classes. You can put unmapped classes anywhere in the hierarchy.
:::code language="csharp" source="~/snippets/csharp/System.Data.Linq.Mapping/InheritanceMappingAttribute/Overview/Program.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Data.Linq.Mapping.InheritanceMappingAttribute/vb/Module1.vb" id="Snippet2":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public InheritanceMappingAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.Linq.Mapping.InheritanceMappingAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 InheritanceMappingAttribute();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data.Linq</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Data.Linq.Mapping.InheritanceMappingAttribute" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Code">
<MemberSignature Language="C#" Value="public object Code { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object Code" />
<MemberSignature Language="DocId" Value="P:System.Data.Linq.Mapping.InheritanceMappingAttribute.Code" />
<MemberSignature Language="VB.NET" Value="Public Property Code As Object" />
<MemberSignature Language="F#" Value="member this.Code : obj with get, set" Usage="System.Data.Linq.Mapping.InheritanceMappingAttribute.Code" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Object ^ Code { System::Object ^ get(); void set(System::Object ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data.Linq</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the discriminator code value in a mapped inheritance hierarchy.</summary>
<value>Must be user-specified. There is no default value.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IsDefault">
<MemberSignature Language="C#" Value="public bool IsDefault { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsDefault" />
<MemberSignature Language="DocId" Value="P:System.Data.Linq.Mapping.InheritanceMappingAttribute.IsDefault" />
<MemberSignature Language="VB.NET" Value="Public Property IsDefault As Boolean" />
<MemberSignature Language="F#" Value="member this.IsDefault : bool with get, set" Usage="System.Data.Linq.Mapping.InheritanceMappingAttribute.IsDefault" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool IsDefault { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data.Linq</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets whether an object of this type in instantiated when the discriminator value does not match a specified value.</summary>
<value>Default = <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Exactly one of the <xref:System.Data.Linq.Mapping.InheritanceMappingAttribute> attributes must be declared with <xref:System.Data.Linq.Mapping.InheritanceMappingAttribute.IsDefault%2A> as `true`.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Type">
<MemberSignature Language="C#" Value="public Type Type { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type Type" />
<MemberSignature Language="DocId" Value="P:System.Data.Linq.Mapping.InheritanceMappingAttribute.Type" />
<MemberSignature Language="VB.NET" Value="Public Property Type As Type" />
<MemberSignature Language="F#" Value="member this.Type : Type with get, set" Usage="System.Data.Linq.Mapping.InheritanceMappingAttribute.Type" />
<MemberSignature Language="C++ CLI" Value="public:
 property Type ^ Type { Type ^ get(); void set(Type ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data.Linq</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the type of the class in the hierarchy.</summary>
<value>Must be user-specified. There is no default value.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use any non-abstract type in the inheritance hierarchy, including the root type.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>