File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
FluentNHibernate.Testing/AutoMapping/Apm
FluentNHibernate/Automapping Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,19 @@ namespace FluentNHibernate.Testing.AutoMapping.Apm
9
9
[ TestFixture ]
10
10
public partial class AutoPersistenceModelTests : BaseAutoPersistenceTests
11
11
{
12
- #region overrides
12
+ [ Test ]
13
+ public void NaturalIdOverrideShouldOverrideExistingProperty ( )
14
+ {
15
+ var autoMapper = AutoMap . AssemblyOf < ExampleClass > ( )
16
+ . Where ( t => t . Namespace == "FluentNHibernate.Automapping.TestFixtures" )
17
+ . Override < ExampleClass > ( c => c . NaturalId ( ) . Property ( x => x . LineOne , "test" ) ) ;
18
+
19
+ new AutoMappingTester < ExampleClass > ( autoMapper )
20
+ . Element ( "//natural-id/property[@name='LineOne']" )
21
+ . Exists ( )
22
+ . HasThisManyChildNodes ( 1 )
23
+ . Element ( "//natural-id/property[@name='LineOne']/column" ) . HasAttribute ( "name" , "test" ) ;
24
+ }
13
25
14
26
[ Test ]
15
27
public void OverrideShouldOverrideExistingProperty ( )
@@ -340,7 +352,5 @@ public void SubclassOverrideShouldOverrideExistingReferencesAny()
340
352
. Element ( "//subclass/any[@name='DictionaryChild']" ) . Exists ( )
341
353
. Element ( "//subclass/map[@name='DictionaryChild']" ) . DoesntExist ( ) ;
342
354
}
343
-
344
- #endregion
345
355
}
346
356
}
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ void IAutoClasslike.AlterModel(ClassMappingBase mapping)
49
49
if ( providers . Id != null )
50
50
classMapping . Id = providers . Id . GetIdentityMapping ( ) ;
51
51
52
+ if ( providers . NaturalId != null )
53
+ classMapping . NaturalId = providers . NaturalId . GetNaturalIdMapping ( ) ;
54
+
52
55
if ( providers . CompositeId != null )
53
56
classMapping . Id = providers . CompositeId . GetCompositeIdMapping ( ) ;
54
57
You can’t perform that action at this time.
0 commit comments