Skip to content

Commit 5643259

Browse files
committed
Merge pull request #152 from chester89/master
Added configuration property for Sql Server 2012
2 parents 2f6328e + 63c7707 commit 5643259

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/FluentNHibernate.Testing/Cfg/Db/MsSqlConfigurationTester.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ public void MsSql2008_should_default_to_the_Sql2008_dialect()
3939
.ShouldContain("dialect", "NHibernate.Dialect.MsSql2008Dialect, " + typeof(ISession).Assembly.FullName);
4040
}
4141

42+
[Test]
43+
public void MsSql2012_should_default_to_thee_Sql2012_dialect()
44+
{
45+
MsSqlConfiguration.MsSql2012
46+
.ToProperties()
47+
.ShouldContain("dialect", "NHibernate.Dialect.MsSql2012Dialect, " + typeof(ISession).Assembly.FullName);
48+
}
49+
4250
[Test]
4351
public void MsSql_driver_should_default_to_the_SqlClientDriver()
4452
{

src/FluentNHibernate/Cfg/Db/MsSqlConfiguration.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ public static MsSqlConfiguration MsSql2008
2929
{
3030
get { return new MsSqlConfiguration().Dialect<MsSql2008Dialect>(); }
3131
}
32+
33+
public static MsSqlConfiguration MsSql2012
34+
{
35+
get { return new MsSqlConfiguration().Dialect<MsSql2012Dialect>(); }
36+
}
3237
}
3338
}

src/FluentNHibernate/Mapping/ComponentPart.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class ComponentPart<T> : ComponentPartBase<T, ComponentPart<T>>, ICompone
99
{
1010
private readonly Type entity;
1111
private readonly AttributeStore attributes;
12+
private string columnPrefix;
1213

1314
public ComponentPart(Type entity, Member property)
1415
: this(entity, property, new AttributeStore())
@@ -21,6 +22,11 @@ private ComponentPart(Type entity, Member property, AttributeStore attributes)
2122
this.entity = entity;
2223
}
2324

25+
public void ColumnPrefix(string prefix)
26+
{
27+
columnPrefix = prefix;
28+
}
29+
2430
/// <summary>
2531
/// Specify the lazy-load behaviour
2632
/// </summary>
@@ -40,9 +46,10 @@ protected override ComponentMapping CreateComponentMappingRoot(AttributeStore st
4046
{
4147
var componentMappingRoot = new ComponentMapping(ComponentType.Component, store)
4248
{
43-
ContainingEntityType = entity,
49+
ContainingEntityType = entity
4450
};
4551
componentMappingRoot.Set(x => x.Class, Layer.Defaults, new TypeReference(typeof(T)));
52+
componentMappingRoot.ColumnPrefix = columnPrefix;
4653
return componentMappingRoot;
4754
}
4855
}

0 commit comments

Comments
 (0)