File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
FluentNHibernate.Testing/DomainModel/Mapping Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -162,5 +162,18 @@ public void LazyLoadResetsNotValue()
162
162
. Not . LazyLoad ( ) . Not . Nullable ( ) )
163
163
. Element ( "class/many-to-one/column" ) . HasAttribute ( "not-null" , "true" ) ;
164
164
}
165
+
166
+ [ Test ]
167
+ public void ManyToOneFormulaShouldSetFormulaAndNotRenderColumn ( )
168
+ {
169
+ new MappingTester < MappedObject > ( )
170
+ . ForMapping ( map =>
171
+ {
172
+ map . References ( x => x . Parent )
173
+ . Formula ( "foo(bar)" ) ;
174
+ } )
175
+ . Element ( "class/many-to-one" ) . HasAttribute ( "formula" , "foo(bar)" )
176
+ . Element ( "class/many-to-one/column" ) . DoesntExist ( ) ;
177
+ }
165
178
}
166
179
}
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ ManyToOneMapping IManyToOneMappingProvider.GetManyToOneMapping()
353
353
mapping . Set ( x => x . Name , Layer . Defaults , member . Name ) ;
354
354
mapping . Set ( x => x . Class , Layer . Defaults , new TypeReference ( typeof ( TOther ) ) ) ;
355
355
356
- if ( columns . Count == 0 )
356
+ if ( columns . Count == 0 && ! mapping . IsSpecified ( "Formula" ) )
357
357
mapping . AddColumn ( Layer . Defaults , CreateColumn ( member . Name + "_id" ) ) ;
358
358
359
359
foreach ( var column in columns )
You can’t perform that action at this time.
0 commit comments