Skip to content

Commit ffd4c39

Browse files
committed
ICollectionInstance - add method KeyUpdate() to handle 'update' attribute on a key.
1 parent d3232ef commit ffd4c39

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/HasManyCollectionConventionTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,22 @@ public void KeyNotNullableShouldSetModelValue()
208208
VerifyModel(x => x.Key.NotNull.ShouldBeTrue());
209209
}
210210

211+
[Test]
212+
public void KeyUpdateShouldSetModelValue()
213+
{
214+
Convention(x => x.KeyUpdate());
215+
216+
VerifyModel(x => x.Key.Update.ShouldBeTrue());
217+
}
218+
219+
[Test]
220+
public void KeyNotUpdateShouldSetModelValue()
221+
{
222+
Convention(x => x.Not.KeyUpdate());
223+
224+
VerifyModel(x => x.Key.Update.ShouldBeFalse());
225+
}
226+
211227
[Test]
212228
public void ShouldSetTableNameProperty()
213229
{

src/FluentNHibernate/Conventions/Instances/CollectionInstance.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public void KeyNullable()
128128
nextBool = true;
129129
}
130130

131+
public void KeyUpdate()
132+
{
133+
mapping.Key.Set(x => x.Update, Layer.Conventions, nextBool);
134+
nextBool = true;
135+
}
136+
131137
public void Table(string tableName)
132138
{
133139
mapping.Set(x => x.TableName, Layer.Conventions, tableName);

src/FluentNHibernate/Conventions/Instances/ICollectionInstance.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ public interface ICollectionInstance : ICollectionInspector
4444
new void Sort(string sort);
4545
void Subselect(string subselect);
4646
void KeyNullable();
47+
void KeyUpdate();
4748
}
4849
}

0 commit comments

Comments
 (0)