@@ -128,6 +128,7 @@ IPropertyIgnorer IPropertyIgnorer.IgnoreProperties(Func<Member, bool> predicate)
128
128
return this ;
129
129
}
130
130
131
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
131
132
public AutoJoinedSubClassPart < TSubclass > JoinedSubClass < TSubclass > ( string keyColumn , Action < AutoJoinedSubClassPart < TSubclass > > action )
132
133
where TSubclass : T
133
134
{
@@ -142,6 +143,7 @@ public AutoJoinedSubClassPart<TSubclass> JoinedSubClass<TSubclass>(string keyCol
142
143
return joinedclass ;
143
144
}
144
145
146
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
145
147
public IAutoClasslike JoinedSubClass ( Type type , string keyColumn )
146
148
{
147
149
var genericType = typeof ( AutoJoinedSubClassPart < > ) . MakeGenericType ( type ) ;
@@ -153,12 +155,14 @@ public IAutoClasslike JoinedSubClass(Type type, string keyColumn)
153
155
return ( IAutoClasslike ) joinedclass ;
154
156
}
155
157
158
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
156
159
public AutoJoinedSubClassPart < TSubclass > JoinedSubClass < TSubclass > ( string keyColumn )
157
160
where TSubclass : T
158
161
{
159
162
return JoinedSubClass < TSubclass > ( keyColumn , null ) ;
160
163
}
161
164
165
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
162
166
public AutoSubClassPart < TSubclass > SubClass < TSubclass > ( object discriminatorValue , Action < AutoSubClassPart < TSubclass > > action )
163
167
where TSubclass : T
164
168
{
@@ -174,12 +178,14 @@ public AutoSubClassPart<TSubclass> SubClass<TSubclass>(object discriminatorValue
174
178
return subclass ;
175
179
}
176
180
181
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
177
182
public AutoSubClassPart < TSubclass > SubClass < TSubclass > ( object discriminatorValue )
178
183
where TSubclass : T
179
184
{
180
185
return SubClass < TSubclass > ( discriminatorValue , null ) ;
181
186
}
182
187
188
+ [ Obsolete ( "Inline definitions of subclasses are depreciated. Please create a derived class from SubclassMap in the same way you do with ClassMap." ) ]
183
189
public IAutoClasslike SubClass ( Type type , string discriminatorValue )
184
190
{
185
191
var genericType = typeof ( AutoSubClassPart < > ) . MakeGenericType ( type ) ;
@@ -212,5 +218,24 @@ public void Join(string table, Action<AutoJoinPart<T>> action)
212
218
return null ;
213
219
}
214
220
#pragma warning restore 809
221
+
222
+ /// <summary>
223
+ /// Adds a column to the key for this subclass, if used
224
+ /// in a table-per-subclass strategy.
225
+ /// </summary>
226
+ /// <param name="column">Column name</param>
227
+ public void KeyColumn ( string column )
228
+ {
229
+ KeyMapping key ;
230
+
231
+ if ( attributes . IsSpecified ( "Key" ) )
232
+ key = attributes . GetOrDefault < KeyMapping > ( "Key" ) ;
233
+ else
234
+ key = new KeyMapping ( ) ;
235
+
236
+ key . AddColumn ( Layer . UserSupplied , new ColumnMapping ( column ) ) ;
237
+
238
+ attributes . Set ( "Key" , Layer . UserSupplied , key ) ;
239
+ }
215
240
}
216
241
}
0 commit comments