Skip to content

Commit 6166cb5

Browse files
Switch from old SqlClientDriver to Sql2008ClientDriver
1 parent 09f8724 commit 6166cb5

File tree

12 files changed

+30
-20
lines changed

12 files changed

+30
-20
lines changed

build-common/nhibernate-properties.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<project xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd">
33
<property name="nhibernate.dialect" value="NHibernate.Dialect.MsSql2008Dialect" overwrite="false"/>
44
<property name="nhibernate.command_timeout" value="444" overwrite="false"/>
5-
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" overwrite="false"/>
5+
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.Sql2008ClientDriver" overwrite="false"/>
66
<property name="nhibernate.connection.connection_string" value="Server=.\SQLExpress;initial catalog=nhibernate;Integrated Security=SSPI" overwrite="false"/>
77
</project>

build-common/teamcity-hibernate.cfg.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<property name="format_sql">true</property>
1616

1717
<!-- This is the System.Data.dll provider for MSSQL Server -->
18-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
18+
<property name="connection.driver_class">NHibernate.Driver.Sql2008ClientDriver</property>
1919
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
2020
<property name="connection.connection_string">Server=.\SQLExpress;initial catalog=nhibernate;Integrated Security=SSPI</property>
2121
<property name="show_sql">false</property>

src/NHibernate.Config.Templates/MSSQL.cfg.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ for your own use before compile tests in VisualStudio.
77
<!-- This is the System.Data.dll provider for SQL Server -->
88
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
99
<session-factory name="NHibernate.Test">
10-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
10+
<property name="connection.driver_class">NHibernate.Driver.Sql2008ClientDriver</property>
1111
<property name="connection.connection_string">
1212
Server=(local);initial catalog=nhibernate;Integrated Security=SSPI
1313
</property>
1414
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
1515
</session-factory>
16-
</hibernate-configuration>
16+
</hibernate-configuration>

src/NHibernate.Example.Web/Infrastructure/AppSessionFactory.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public AppSessionFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFacto
2424
{
2525
db.ConnectionString = @"Server=(local)\SQLEXPRESS;initial catalog=nhibernate;Integrated Security=true";
2626
db.Dialect<MsSql2008Dialect>();
27-
db.Driver<SqlClientDriver>();
27+
db.Driver<Sql2008ClientDriver>();
2828
})
2929
.AddMapping(domainMapping);
3030
Configuration.SessionFactory().GenerateStatistics();
@@ -37,4 +37,4 @@ public ISession OpenSession()
3737
return SessionFactory.OpenSession();
3838
}
3939
}
40-
}
40+
}

src/NHibernate.Test/App.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
3232

33-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> <!-- Shouldn't be necessary, but is required by some tests -->
33+
<property name="connection.driver_class">NHibernate.Driver.Sql2008ClientDriver</property> <!-- Shouldn't be necessary, but is required by some tests -->
3434
<property name="connection.connection_string_name">TestConnectionString</property>
3535
<property name="connection.provider">NHibernate.Test.DebugConnectionProvider, NHibernate.Test</property>
3636
<property name="connection.isolation">ReadCommitted</property> <!-- See System.Data.IsolationLevel for valid values -->

src/NHibernate.Test/Async/Hql/Ast/LimitClauseFixture.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
using System.Linq;
1212
using NHibernate.Cfg;
13+
using NHibernate.Driver;
1314
using NHibernate.Hql.Ast.ANTLR;
15+
using NHibernate.Util;
1416
using NUnit.Framework;
1517

1618
namespace NHibernate.Test.Hql.Ast
@@ -22,7 +24,8 @@ public class LimitClauseFixtureAsync : BaseFixture
2224
protected override bool AppliesTo(Dialect.Dialect dialect)
2325
{
2426
return dialect.SupportsVariableLimit
25-
&& !(Dialect is Dialect.MsSql2000Dialect && cfg.Properties[Environment.ConnectionDriver] == typeof(Driver.OdbcDriver).FullName); // don't know why, but these tests don't work on SQL Server using ODBC
27+
&& !(Dialect is Dialect.MsSql2000Dialect && // don't know why, but these tests don't work on SQL Server using ODBC
28+
typeof(OdbcDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))));
2629
}
2730

2831
protected override void OnSetUp()
@@ -186,4 +189,4 @@ public async Task TakeWithParameterAsync()
186189
s.Close();
187190
}
188191
}
189-
}
192+
}

src/NHibernate.Test/Async/NHSpecificTest/NH1144/Fixture.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using NHibernate.AdoNet;
1313
using NHibernate.Cfg;
1414
using NHibernate.Driver;
15+
using NHibernate.Util;
1516
using NUnit.Framework;
1617

1718
namespace NHibernate.Test.NHSpecificTest.NH1144
@@ -36,7 +37,7 @@ protected override void Configure(Configuration configuration)
3637
[Test]
3738
public async Task CanSaveInSingleBatchAsync()
3839
{
39-
if (configuration.Properties[Environment.ConnectionDriver].Contains(typeof (OracleDataClientDriver).Name) == false)
40+
if (!typeof(OracleDataClientDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))))
4041
{
4142
Assert.Ignore("Only applicable for Oracle Data Client driver");
4243
}
@@ -85,4 +86,4 @@ public async Task CanSaveInSingleBatchAsync()
8586
Assert.IsTrue(executedBatch);
8687
}
8788
}
88-
}
89+
}

src/NHibernate.Test/Async/NHSpecificTest/NH3202/Fixture.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using NHibernate.Cfg;
1414
using NHibernate.Dialect;
1515
using NHibernate.Driver;
16+
using NHibernate.Util;
1617
using NUnit.Framework;
1718

1819
namespace NHibernate.Test.NHSpecificTest.NH3202
@@ -26,7 +27,7 @@ protected override void Configure(Configuration configuration)
2627
if (!(Dialect is MsSql2008Dialect))
2728
Assert.Ignore("Test is for MS SQL Server dialect only (custom dialect).");
2829

29-
if (!Environment.ConnectionDriver.Contains("SqlClientDriver"))
30+
if (!typeof(SqlClientDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))))
3031
Assert.Ignore("Test is for MS SQL Server driver only (custom driver is used).");
3132

3233
cfg.SetProperty(Environment.Dialect, typeof(OffsetStartsAtOneTestDialect).AssemblyQualifiedName);

src/NHibernate.Test/Hql/Ast/LimitClauseFixture.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System.Linq;
22
using NHibernate.Cfg;
3+
using NHibernate.Driver;
34
using NHibernate.Hql.Ast.ANTLR;
5+
using NHibernate.Util;
46
using NUnit.Framework;
57

68
namespace NHibernate.Test.Hql.Ast
@@ -11,7 +13,8 @@ public class LimitClauseFixture : BaseFixture
1113
protected override bool AppliesTo(Dialect.Dialect dialect)
1214
{
1315
return dialect.SupportsVariableLimit
14-
&& !(Dialect is Dialect.MsSql2000Dialect && cfg.Properties[Environment.ConnectionDriver] == typeof(Driver.OdbcDriver).FullName); // don't know why, but these tests don't work on SQL Server using ODBC
16+
&& !(Dialect is Dialect.MsSql2000Dialect && // don't know why, but these tests don't work on SQL Server using ODBC
17+
typeof(OdbcDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))));
1518
}
1619

1720
protected override void OnSetUp()
@@ -175,4 +178,4 @@ public void TakeWithParameter()
175178
s.Close();
176179
}
177180
}
178-
}
181+
}

src/NHibernate.Test/NHSpecificTest/NH1144/Fixture.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using NHibernate.AdoNet;
33
using NHibernate.Cfg;
44
using NHibernate.Driver;
5+
using NHibernate.Util;
56
using NUnit.Framework;
67

78
namespace NHibernate.Test.NHSpecificTest.NH1144
@@ -25,7 +26,7 @@ protected override void Configure(Configuration configuration)
2526
[Test]
2627
public void CanSaveInSingleBatch()
2728
{
28-
if (configuration.Properties[Environment.ConnectionDriver].Contains(typeof (OracleDataClientDriver).Name) == false)
29+
if (!typeof(OracleDataClientDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))))
2930
{
3031
Assert.Ignore("Only applicable for Oracle Data Client driver");
3132
}
@@ -74,4 +75,4 @@ public void CanSaveInSingleBatch()
7475
Assert.IsTrue(executedBatch);
7576
}
7677
}
77-
}
78+
}

src/NHibernate.Test/NHSpecificTest/NH3202/Fixture.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using NHibernate.Cfg;
44
using NHibernate.Dialect;
55
using NHibernate.Driver;
6+
using NHibernate.Util;
67
using NUnit.Framework;
78

89
namespace NHibernate.Test.NHSpecificTest.NH3202
@@ -15,7 +16,7 @@ protected override void Configure(Configuration configuration)
1516
if (!(Dialect is MsSql2008Dialect))
1617
Assert.Ignore("Test is for MS SQL Server dialect only (custom dialect).");
1718

18-
if (!Environment.ConnectionDriver.Contains("SqlClientDriver"))
19+
if (!typeof(SqlClientDriver).IsAssignableFrom(ReflectHelper.ClassForName(cfg.GetProperty(Environment.ConnectionDriver))))
1920
Assert.Ignore("Test is for MS SQL Server driver only (custom driver is used).");
2021

2122
cfg.SetProperty(Environment.Dialect, typeof(OffsetStartsAtOneTestDialect).AssemblyQualifiedName);

src/NHibernate.TestDatabaseSetup/App.config

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<configuration>
33
<configSections>
44
<section name="hibernate-configuration"
5-
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
5+
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
66
</configSections>
77

88
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
99
<session-factory name="NHibernate.TestDatabaseSetup">
10-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
11-
<property name="connection.connection_string">
10+
<property name="connection.driver_class">NHibernate.Driver.Sql2008ClientDriver</property>
11+
<property name="connection.connection_string">
1212
Server=.\SQLExpress;initial catalog=master;Integrated Security=SSPI
1313
</property>
1414
</session-factory>

0 commit comments

Comments
 (0)