From 79617819a87b84107f211922d9c029cad3772de6 Mon Sep 17 00:00:00 2001 From: Esben Bach Date: Wed, 17 Apr 2024 14:54:57 +0200 Subject: [PATCH 1/2] Replaced System.Data.SqlClient with Microsoft.Data.SqlClient for non-net462 targets. --- .../NEventStore.Persistence.MsSql.Core.Tests.csproj | 2 +- .../PersistenceEngineFixture.cs | 4 ++++ .../TransactionIsolationLevelTests.cs | 4 ++-- src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs | 9 +++++++-- .../NEventStore.Persistence.Sql.Core.csproj | 2 +- .../SqlDialects/MsSqlDialect.cs | 4 ++++ 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj b/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj index 3239aef..3d3db3a 100644 --- a/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj +++ b/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/NEventStore.Persistence.MsSql.Tests/PersistenceEngineFixture.cs b/src/NEventStore.Persistence.MsSql.Tests/PersistenceEngineFixture.cs index 0e62580..3fba625 100644 --- a/src/NEventStore.Persistence.MsSql.Tests/PersistenceEngineFixture.cs +++ b/src/NEventStore.Persistence.MsSql.Tests/PersistenceEngineFixture.cs @@ -5,7 +5,11 @@ namespace NEventStore.Persistence.AcceptanceTests using NEventStore.Persistence.Sql; using NEventStore.Persistence.Sql.SqlDialects; using NEventStore.Serialization; +#if NET462 using System.Data.SqlClient; +#else + using Microsoft.Data.SqlClient; +#endif using System.Transactions; public partial class PersistenceEngineFixture diff --git a/src/NEventStore.Persistence.MsSql.Tests/TransactionIsolationLevelTests.cs b/src/NEventStore.Persistence.MsSql.Tests/TransactionIsolationLevelTests.cs index 33050bc..64b21e0 100644 --- a/src/NEventStore.Persistence.MsSql.Tests/TransactionIsolationLevelTests.cs +++ b/src/NEventStore.Persistence.MsSql.Tests/TransactionIsolationLevelTests.cs @@ -6,6 +6,7 @@ using FluentAssertions; #if NET462 using NEventStore.Diagnostics; +using System.Data.SqlClient; #endif using NEventStore.Persistence.AcceptanceTests.BDD; using NEventStore.Persistence.Sql; @@ -18,7 +19,6 @@ #endif #if NUNIT using NUnit.Framework; -using System.Data.SqlClient; #endif #if XUNIT using Xunit; @@ -126,7 +126,7 @@ public IsolationLevelPersistenceEngineFixture() #if NET462 _connectionFactory = new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient"); #else - _connectionFactory = new EnviromentConnectionFactory("MsSql", System.Data.SqlClient.SqlClientFactory.Instance); + _connectionFactory = new EnviromentConnectionFactory("MsSql", Microsoft.Data.SqlClient.SqlClientFactory.Instance); #endif _createPersistence = () => new SqlPersistenceFactory(_connectionFactory, diff --git a/src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs b/src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs index 8b6eda3..d7f5a7c 100644 --- a/src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs +++ b/src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs @@ -10,9 +10,14 @@ namespace NEventStore.Persistence.AcceptanceTests #if MSTEST using Microsoft.VisualStudio.TestTools.UnitTesting; #endif +#if NET462 + using System.Data.SqlClient; +#else + using Microsoft.Data.SqlClient; +#endif #if NUNIT using NUnit.Framework; - using System.Data.SqlClient; + #endif #if XUNIT using Xunit; @@ -34,7 +39,7 @@ protected override void Context() #if NET462 .UsingSqlPersistence(new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient")) #else - .UsingSqlPersistence(new EnviromentConnectionFactory("MsSql", System.Data.SqlClient.SqlClientFactory.Instance)) + .UsingSqlPersistence(new EnviromentConnectionFactory("MsSql", Microsoft.Data.SqlClient.SqlClientFactory.Instance)) #endif .WithDialect(new MsSqlDialect()) .WithStreamIdHasher(streamId => diff --git a/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj b/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj index caf90b8..b62fe49 100644 --- a/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj +++ b/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/NEventStore.Persistence.Sql/SqlDialects/MsSqlDialect.cs b/src/NEventStore.Persistence.Sql/SqlDialects/MsSqlDialect.cs index 0de1364..abeaba6 100644 --- a/src/NEventStore.Persistence.Sql/SqlDialects/MsSqlDialect.cs +++ b/src/NEventStore.Persistence.Sql/SqlDialects/MsSqlDialect.cs @@ -5,7 +5,11 @@ namespace NEventStore.Persistence.Sql.SqlDialects { using System; +#if NET462 using System.Data.SqlClient; +#else + using Microsoft.Data.SqlClient; +#endif public class MsSqlDialect : CommonSqlDialect { From f9416426fae08b1eea33bc40303270b6dcd1184a Mon Sep 17 00:00:00 2001 From: Esben Bach Date: Wed, 17 Apr 2024 15:00:30 +0200 Subject: [PATCH 2/2] Added leftout System.Data.SqlClient for net462 --- .../NEventStore.Persistence.MsSql.Core.Tests.csproj | 1 + .../NEventStore.Persistence.Sql.Core.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj b/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj index 3d3db3a..9c26079 100644 --- a/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj +++ b/src/NEventStore.Persistence.MsSql.Tests/NEventStore.Persistence.MsSql.Core.Tests.csproj @@ -17,6 +17,7 @@ + diff --git a/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj b/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj index b62fe49..dcbc7e6 100644 --- a/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj +++ b/src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj @@ -31,6 +31,7 @@ +