Skip to content

Commit 8f69001

Browse files
committed
FIX: Lazy on key-many-to-one was using "true" instead of "proxy"
1 parent c5d8de8 commit 8f69001

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ public void KeyManyToOneDefaults()
5353
.HasAttribute("class", typeof(CompIdChild).AssemblyQualifiedName);
5454
}
5555

56+
[Test]
57+
public void KeyManyToOneLazySetToProxyForTrue()
58+
{
59+
new MappingTester<CompIdTarget>()
60+
.ForMapping(c => c.CompositeId().KeyReference(x => x.Child, m => m.Lazy()))
61+
.Element("class/composite-id/key-many-to-one")
62+
.HasAttribute("lazy", "proxy");
63+
}
64+
5665
[Test]
5766
public void KeyManyToOneExplicitColumnName()
5867
{

src/FluentNHibernate.Testing/MappingModel/Output/XmlKeyManyToOneWriterTester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void ShouldWriteForeignKeyAttribute()
5858
public void ShouldWriteLazyAttribute()
5959
{
6060
var testHelper = new XmlWriterTestHelper<KeyManyToOneMapping>();
61-
testHelper.Check(x => x.Lazy, true).MapsToAttribute("lazy");
61+
testHelper.Check(x => x.Lazy, true).MapsToAttribute("lazy", "proxy");
6262

6363
testHelper.VerifyAll(writer);
6464
}

src/FluentNHibernate/MappingModel/Output/XmlKeyManyToOneWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void ProcessKeyManyToOne(KeyManyToOneMapping mapping)
4141
element.WithAtt("foreign-key", mapping.ForeignKey);
4242

4343
if (mapping.HasValue(x => x.Lazy))
44-
element.WithAtt("lazy", mapping.Lazy);
44+
element.WithAtt("lazy", mapping.Lazy ? "proxy" : "false");
4545

4646
if (mapping.HasValue(x => x.NotFound))
4747
element.WithAtt("not-found", mapping.NotFound);

0 commit comments

Comments
 (0)