Skip to content

Commit 207f6e4

Browse files
committed
Add DiscriminatorValue method to IClassInstance
Fixes #134 +semver:feature
1 parent 626baf3 commit 207f6e4

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ public void ShouldSetCacheProperty()
3636
VerifyModel(x => x.Cache.Usage.ShouldEqual("read-only"));
3737
}
3838

39+
[Test]
40+
public void ShouldSetDiscriminatorValueProperty()
41+
{
42+
Convention(x => x.DiscriminatorValue("0"));
43+
44+
VerifyModel(x => x.DiscriminatorValue.ShouldEqual("0"));
45+
}
46+
3947
[Test]
4048
public void ShouldSetDynamicInsertProperty()
4149
{

src/FluentNHibernate/Conventions/Instances/ClassInstance.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public void Table(string tableName)
3838
mapping.Set(x => x.TableName, Layer.Conventions, tableName);
3939
}
4040

41+
public new void DiscriminatorValue(object value)
42+
{
43+
mapping.Set(x => x.DiscriminatorValue, Layer.Conventions, value);
44+
}
45+
4146
public new void DynamicInsert()
4247
{
4348
mapping.Set(x => x.DynamicInsert, Layer.Conventions, nextBool);

src/FluentNHibernate/Conventions/Instances/IClassInstance.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public interface IClassInstance : IClassInspector
1313
new ICacheInstance Cache { get; }
1414
new ISchemaActionInstance SchemaAction { get; }
1515
void Table(string tableName);
16+
new void DiscriminatorValue(object value);
1617
new void DynamicInsert();
1718
new void DynamicUpdate();
1819
new void BatchSize(int size);
@@ -56,5 +57,6 @@ public interface IClassInstance : IClassInspector
5657
/// defining the filter to apply.
5758
/// </typeparam>
5859
void ApplyFilter<TFilter>() where TFilter : FilterDefinition, new();
60+
5961
}
6062
}

0 commit comments

Comments
 (0)