File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/FluentNHibernate.Testing/AutoMapping/Apm Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 3
3
using FluentNHibernate . Automapping . TestFixtures ;
4
4
using FluentNHibernate . Automapping . TestFixtures . ComponentTypes ;
5
5
using FluentNHibernate . Automapping . TestFixtures . CustomTypes ;
6
+ using FluentNHibernate . Conventions ;
7
+ using FluentNHibernate . Conventions . Instances ;
6
8
using FluentNHibernate . Testing . Automapping ;
7
9
using NUnit . Framework ;
8
10
@@ -122,6 +124,16 @@ public void ComponentPropertiesAssumeComponentColumnPrefix()
122
124
. Element ( "class/component[@name='WorkAddress']/property[@name='Number']/column" ) . HasAttribute ( "name" , "WorkAddress_Number" ) ;
123
125
}
124
126
127
+ [ Test ]
128
+ public void ComponentPropertiesAssumeComponentColumnPrefixWithPropertyConvention ( )
129
+ {
130
+ var autoMapper = AutoMap . Source ( source , addressCfg )
131
+ . Conventions . Add < CustomColumnNameConvention > ( ) ;
132
+
133
+ new AutoMappingTester < Customer > ( autoMapper )
134
+ . Element ( "class/component[@name='WorkAddress']/property[@name='Number']/column" ) . HasAttribute ( "name" , "WorkAddress_Number1" ) ;
135
+ }
136
+
125
137
[ Test ]
126
138
public void ComponentColumnConventionReceivesProperty ( )
127
139
{
@@ -159,5 +171,13 @@ public override string GetComponentColumnPrefix(Member member)
159
171
return member . Name + "_" ;
160
172
}
161
173
}
174
+
175
+ class CustomColumnNameConvention : IPropertyConvention
176
+ {
177
+ public void Apply ( IPropertyInstance instance )
178
+ {
179
+ instance . Column ( instance . Name + "1" ) ;
180
+ }
181
+ }
162
182
}
163
183
}
You can’t perform that action at this time.
0 commit comments