Skip to content

Commit c796105

Browse files
hazzikjagregory
authored andcommitted
Failed test for check that component Column name convention does not broke ColumnPrefix
https://groups.google.com/d/msg/fluent-nhibernate/-/4nrGcERCVJQJ
1 parent 1a83268 commit c796105

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/FluentNHibernate.Testing/AutoMapping/Apm/AutoPersistenceModelTests.Components.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using FluentNHibernate.Automapping.TestFixtures;
44
using FluentNHibernate.Automapping.TestFixtures.ComponentTypes;
55
using FluentNHibernate.Automapping.TestFixtures.CustomTypes;
6+
using FluentNHibernate.Conventions;
7+
using FluentNHibernate.Conventions.Instances;
68
using FluentNHibernate.Testing.Automapping;
79
using NUnit.Framework;
810

@@ -122,6 +124,16 @@ public void ComponentPropertiesAssumeComponentColumnPrefix()
122124
.Element("class/component[@name='WorkAddress']/property[@name='Number']/column").HasAttribute("name", "WorkAddress_Number");
123125
}
124126

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+
125137
[Test]
126138
public void ComponentColumnConventionReceivesProperty()
127139
{
@@ -159,5 +171,13 @@ public override string GetComponentColumnPrefix(Member member)
159171
return member.Name + "_";
160172
}
161173
}
174+
175+
class CustomColumnNameConvention : IPropertyConvention
176+
{
177+
public void Apply(IPropertyInstance instance)
178+
{
179+
instance.Column(instance.Name + "1");
180+
}
181+
}
162182
}
163183
}

0 commit comments

Comments
 (0)