Skip to content

Commit 3deb504

Browse files
authored
Merge pull request #128 from nhibernate/sql-client
Replace System.Data.SqlClient with Microsoft.Data.SqlClient
2 parents e218e19 + d679b91 commit 3deb504

File tree

9 files changed

+28
-26
lines changed

9 files changed

+28
-26
lines changed

NHibernate.Spatial.MsSql/NHibernate.Spatial.MsSql.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="NetTopologySuite.IO.SqlServerBytes" Version="2.0.0" />
23-
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
22+
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
23+
<PackageReference Include="NetTopologySuite.IO.SqlServerBytes" Version="2.1.0" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

NHibernate.Spatial.MsSql/Type/MsSqlGeometryType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Data;
33
using System.Data.Common;
4-
using System.Data.SqlClient;
4+
using Microsoft.Data.SqlClient;
55
using NetTopologySuite.Geometries;
66
using NetTopologySuite.IO;
77
using NHibernate.Engine;

Tests.NHibernate.Spatial.MsSql2008/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ In order to run the tests, a MS SQL Server 2008 instance must be available for c
44

55
### Installation
66

7-
MS SQL Server 2008 Express with Tools is free and can be downloaded from the [MS website](https://www.microsoft.com/en-us/download/details.aspx?id=22973).
7+
MS SQL Server 2008 Express with Tools is free and can be downloaded from the [MS website](https://www.microsoft.com/en-us/download/details.aspx?id=30438) (download and install the `SQLEXPRWT_x64_ENU.exe` package).
88

99
### Configuration
1010

1111
Once MS SQL Server 2008 has been set up, it must be initialized for testing:
1212

1313
1. Ensure that the "Server authentication" is set to "SQL Server and Windows Authentication mode" (see image below).
1414

15-
![Server authentication](http://i.imgur.com/SxkyVpx.png)
15+
![Server authentication](https://i.imgur.com/SxkyVpx.png)
1616

1717
2. After changing the authentication mode, the server must be restarted for the changes to take effect (this can be done via the "SQL Server Configuration Manager").
1818

1919
3. Add a new `nhsp_test` user, using SQL Server authentication with `nhsp_test` for the password and making sure to untick "Enforce password policy" (see image below).
2020

21-
![Create new user](http://i.imgur.com/VIOArTc.png)
21+
![Create new user](https://i.imgur.com/VIOArTc.png)
2222

2323
4. Create a new `nhsp_test` database, owned by the `nhsp_test` user (see image below).
2424

25-
![Create new database](http://i.imgur.com/93mrjwn.png)
25+
![Create new database](https://i.imgur.com/93mrjwn.png)
2626

27-
5. Finally, the `Server=.` part of the connection string in the [app.config](app.config) file should be updated with the name of your server instance, e.g. `Server=hostname\MSSQLSERVER2008`.
27+
5. Finally, the `Server=.` part of the connection string in the [appsettings.json](appsettings.json) file should be updated with the name of your server instance, e.g. `Server=hostname\MSSQLSERVER2008`.

Tests.NHibernate.Spatial.MsSql2008/TestConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static void Configure(Configuration configuration)
2525
[Environment.ProxyFactoryFactoryClass] = typeof(StaticProxyFactoryFactory).AssemblyQualifiedName,
2626
[Environment.Dialect] = typeof(MsSql2008GeometryDialect).AssemblyQualifiedName,
2727
[Environment.ConnectionProvider] = typeof(DebugConnectionProvider).AssemblyQualifiedName,
28-
[Environment.ConnectionDriver] = typeof(SqlClientDriver).AssemblyQualifiedName,
28+
[Environment.ConnectionDriver] = typeof(MicrosoftDataSqlClientDriver).AssemblyQualifiedName,
2929
[Environment.ConnectionString] = _configurationRoot.GetConnectionString("MsSql2008")
3030
};
3131
configuration.SetProperties(properties);
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"ConnectionStrings": {
3-
"_comment": " NOTE: Must specify SQL Server 2012 rather than SQL Server 2008 for the Type System Version attribute (see issue #72)",
4-
"MsSql2008": "Server=(local)\\SQL2008R2SP2;Initial Catalog=nhsp_test;User ID=nhsp_test;Password=nhsp_test;Type System Version=SQL Server 2012"
3+
"_comment1": "NOTE: Must specify SQL Server 2012 rather than SQL Server 2008 for the Type System Version attribute (see issue #72)",
4+
"_comment2": "NOTE: TrustServerCertificate=True required after updating from System.Data.Sql to Microsoft.Data.Sql as Encrypt is now set to true by default; see: https://stackoverflow.com/a/17658821/3628232",
5+
"MsSql2008": "Server=(local)\\MSSQLSERVER2008;Initial Catalog=nhsp_test;User ID=nhsp_test;Password=nhsp_test;Type System Version=SQL Server 2012;TrustServerCertificate=True"
56
}
67
}

Tests.NHibernate.Spatial.MsSql2012/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ In order to run the tests, a MS SQL Server 2012 instance must be available for c
44

55
### Installation
66

7-
MS SQL Server 2012 Express with Tools is free and can be downloaded from the [MS website]().
7+
MS SQL Server 2012 Express with Tools is free and can be downloaded from the [MS website](https://www.microsoft.com/en-us/download/details.aspx?id=50003) (download and install the `SQLEXPRWT_x64_ENU.exe` package).
88

99
### Configuration
1010

1111
Once MS SQL Server 2012 has been set up, it must be initialized for testing:
1212

1313
1. Ensure that the "Server authentication" is set to "SQL Server and Windows Authentication mode" (see image below).
1414

15-
![Server authentication](http://i.imgur.com/SxkyVpx.png)
15+
![Server authentication](https://i.imgur.com/SxkyVpx.png)
1616

1717
2. After changing the authentication mode, the server must be restarted for the changes to take effect (this can be done via the "SQL Server Configuration Manager").
1818

1919
3. Add a new `nhsp_test` user, using SQL Server authentication with `nhsp_test` for the password and making sure to untick "Enforce password policy" (see image below).
2020

21-
![Create new user](http://i.imgur.com/VIOArTc.png)
21+
![Create new user](https://i.imgur.com/VIOArTc.png)
2222

2323
4. Create a new `nhsp_test` database, owned by the `nhsp_test` user (see image below).
2424

25-
![Create new database](http://i.imgur.com/93mrjwn.png)
25+
![Create new database](https://i.imgur.com/93mrjwn.png)
2626

27-
5. Finally, the `Server=.` part of the connection string in the [app.config](app.config) file should be updated with the name of your server instance, e.g. `Server=(local)\MSSQLSERVER2012`.
27+
5. Finally, the `Server=.` part of the connection string in the [appsettings.json](appsettings.json) file should be updated with the name of your server instance, e.g. `Server=(local)\MSSQLSERVER2012`.

Tests.NHibernate.Spatial.MsSql2012/TestConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static void Configure(Configuration configuration)
2525
[Environment.ProxyFactoryFactoryClass] = typeof(StaticProxyFactoryFactory).AssemblyQualifiedName,
2626
[Environment.Dialect] = typeof(MsSql2012GeometryDialect).AssemblyQualifiedName,
2727
[Environment.ConnectionProvider] = typeof(DebugConnectionProvider).AssemblyQualifiedName,
28-
[Environment.ConnectionDriver] = typeof(SqlClientDriver).AssemblyQualifiedName,
28+
[Environment.ConnectionDriver] = typeof(MicrosoftDataSqlClientDriver).AssemblyQualifiedName,
2929
[Environment.ConnectionString] = _configurationRoot.GetConnectionString("MsSql2012")
3030
};
3131
configuration.SetProperties(properties);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"ConnectionStrings": {
3-
"MsSql2012": "Server=(local)\\SQL2012SP1;Initial Catalog=nhsp_test;User ID=nhsp_test;Password=nhsp_test;Type System Version=SQL Server 2012"
3+
"_comment": "NOTE: TrustServerCertificate=True required after updating from System.Data.Sql to Microsoft.Data.Sql as Encrypt is now set to true by default; see: https://stackoverflow.com/a/17658821/3628232",
4+
"MsSql2012": "Server=(local)\\MSSQLSERVER2012;Initial Catalog=nhsp_test;User ID=nhsp_test;Password=nhsp_test;Type System Version=SQL Server 2012;TrustServerCertificate=True"
45
}
56
}

appveyor.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ image:
1111
install:
1212
# install SQL Server 2008 R2 SP2 Express (not included in VS 2017 image; see: https://www.appveyor.com/docs/build-environment/#databases)
1313
- cmd: curl -L -O -S -s https://download.microsoft.com/download/0/4/B/04BE03CD-EAF3-4797-9D8D-2E08E316C998/SQLEXPR_x64_ENU.exe
14-
- cmd: SQLEXPR_x64_ENU.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /FEATURES=SQL /INSTANCENAME=SQL2008R2SP2 /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=Password12! /ADDCURRENTUSERASSQLADMIN /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service"
14+
- cmd: SQLEXPR_x64_ENU.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /FEATURES=SQL /INSTANCENAME=MSSQLSERVER2008 /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=Password12! /ADDCURRENTUSERASSQLADMIN /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service"
1515

1616
# install SQL Server 2012 SP1 Express (not included in VS 2017 image; see: https://www.appveyor.com/docs/build-environment/#databases)
1717
- cmd: curl -L -O -S -s https://download.microsoft.com/download/5/2/9/529FEF7B-2EFB-439E-A2D1-A1533227CD69/SQLEXPR_x64_ENU.exe
18-
- cmd: SQLEXPR_x64_ENU.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /FEATURES=SQL /INSTANCENAME=SQL2012SP1 /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=Password12! /ADDCURRENTUSERASSQLADMIN /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service"
18+
- cmd: SQLEXPR_x64_ENU.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /FEATURES=SQL /INSTANCENAME=MSSQLSERVER2012 /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=Password12! /ADDCURRENTUSERASSQLADMIN /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service"
1919

2020
# install x86 CLR types for SQL Server 2012 SP1 (required when running dotnet test for MsSql tests)
2121
- cmd: curl -L -O -S -s https://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x86/SQLSysClrTypes.msi
2222
- cmd: SQLSysClrTypes.msi /passive
2323

2424
# enable dynamic TCP ports for 2008 and 2012 SQL Server instances (so they can be run simultaneously)
25-
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
26-
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
27-
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
28-
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
25+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.MSSQLSERVER2008\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
26+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.MSSQLSERVER2008\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
27+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.MSSQLSERVER2012\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
28+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.MSSQLSERVER2012\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
2929

3030
# install MySQL 5.6
3131
# - cmd: curl -L -O -S -s https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-web-community-5.6.36.0.msi
@@ -89,10 +89,10 @@ before_build:
8989
# scripts to run before tests
9090
before_test:
9191
# setup SQL Server 2008
92-
- cmd: sqlcmd -S (local)\SQL2008R2SP2 -i Tests.NHibernate.Spatial.MsSql2008\nhsp_test.sql
92+
- cmd: sqlcmd -S (local)\MSSQLSERVER2008 -i Tests.NHibernate.Spatial.MsSql2008\nhsp_test.sql
9393

9494
# setup SQL Server 2012
95-
- cmd: sqlcmd -S (local)\SQL2012SP1 -i Tests.NHibernate.Spatial.MsSql2012\nhsp_test.sql
95+
- cmd: sqlcmd -S (local)\MSSQLSERVER2012 -i Tests.NHibernate.Spatial.MsSql2012\nhsp_test.sql
9696

9797
# setup MySQL 5.6
9898
# - cmd: net start mysql56

0 commit comments

Comments
 (0)