Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for setting custom type of ToManyBase.Element through lambda-…

…based action callback
  • Loading branch information...
commit 0e45a91e2501243d0da47ec389ea191a95eec668 1 parent 72ce5bc
@maxild maxild authored jagregory committed
View
9 src/FluentNHibernate.Testing/DomainModel/Mapping/OneToManyTester.cs
@@ -402,6 +402,15 @@ public void ElementHasCorrectColumnName()
}
[Test]
+ public void ElementCallsCustomMappingHandler()
+ {
+ var called = false;
+ new MappingTester<OneToManyTarget>()
+ .ForMapping(m => m.HasMany(x => x.ListOfSimpleChildren).Element("columnName", elementPart => called = true));
+ called.ShouldBeTrue();
+ }
+
+ [Test]
public void OneToManyMapping_with_private_backing_field()
{
new MappingTester<OneToManyTarget>()
View
6 src/FluentNHibernate/Mapping/ToManyBase.cs
@@ -306,10 +306,10 @@ public T Element(string columnName)
return (T)this;
}
- public T Element(string columnName, Action<ElementPart> customElement)
+ public T Element(string columnName, Action<ElementPart> customElementMapping)
{
Element(columnName);
- customElement(elementPart);
+ if (customElementMapping != null) customElementMapping(elementPart);
return (T)this;
}
@@ -494,4 +494,4 @@ protected IList<FilterPart> Filters
get { return filters; }
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.