File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
NHibernate/Mapping/ByCode/Impl
NHibernate.Test/MappingByCode/MappersTests Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,25 @@ public void WhenSetBasicColumnValuesThroughShortCutThenMergeColumn()
198
198
mapping . index . Should ( ) . Be ( "II" ) ;
199
199
}
200
200
201
+ [ Test ( Description = "NH-3618" ) ]
202
+ public void SetUniqueToMultiColumn ( )
203
+ {
204
+ var hbmMapping = new HbmMapping ( ) ;
205
+ var member = typeof ( MyClass ) . GetProperty ( "Relation" ) ;
206
+ var mapping = new HbmManyToOne ( ) ;
207
+ var mapper = new ManyToOneMapper ( member , mapping , hbmMapping ) ;
208
+ mapper . Columns ( x => x . Name ( "pizza" ) , x => x . Name ( "pasta" ) ) ;
209
+ mapper . Unique ( true ) ;
210
+ mapper . UniqueKey ( "AA" ) ;
211
+ mapper . Index ( "II" ) ;
212
+
213
+ Assert . That ( mapping . Items , Is . Not . Null . And . Not . Empty ) ;
214
+ Assert . IsNull ( mapping . column ) ;
215
+ Assert . IsTrue ( mapping . unique ) ;
216
+ Assert . That ( mapping . uniquekey , Is . EqualTo ( "AA" ) ) ;
217
+ Assert . That ( mapping . index , Is . EqualTo ( "II" ) ) ;
218
+ }
219
+
201
220
[ Test ]
202
221
public void WhenSetFetchModeToJoinThenSetFetch ( )
203
222
{
Original file line number Diff line number Diff line change @@ -54,17 +54,17 @@ public void NotNullable(bool notnull)
54
54
55
55
public void Unique ( bool unique )
56
56
{
57
- Column ( x => x . Unique ( unique ) ) ;
57
+ _manyToOne . unique = unique ;
58
58
}
59
59
60
60
public void UniqueKey ( string uniquekeyName )
61
61
{
62
- Column ( x => x . UniqueKey ( uniquekeyName ) ) ;
62
+ _manyToOne . uniquekey = uniquekeyName ;
63
63
}
64
64
65
65
public void Index ( string indexName )
66
66
{
67
- Column ( x => x . Index ( indexName ) ) ;
67
+ _manyToOne . index = indexName ;
68
68
}
69
69
70
70
public void Fetch ( FetchKind fetchMode )
You can’t perform that action at this time.
0 commit comments