Skip to content

Commit

Permalink
TFM: netstandard2.0, net462. Updated libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
AGiorgetti committed Jul 31, 2023
1 parent f3b2164 commit ace3571
Show file tree
Hide file tree
Showing 27 changed files with 86 additions and 63 deletions.
12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# NEventStore.Persistence.Sql

## 9.1.1

- Target Framework supported: netstandard2.0, net462
- Updated System.Data.SqlClient 4.8.5
- Fix: NEventStore constraint failed with MySql 8.x (works with 5.7) [#487](https://github.com/NEventStore/NEventStore/issues/487)

### Breaking Change

- The fix for [#487](https://github.com/NEventStore/NEventStore/issues/487) changed how the `Commits` table is created for MySql 8.x:
to update an existing database in order to run on 8.x you need to manually update the `Commits` table schema and change the constraint of the `CommitId` column
from: `CommitId binary(16) NOT NULL CHECK (CommitId != 0)` to: `CommitId binary(16) NOT NULL CHECK (CommitId <> 0x00)`.

## 9.0.1

- Added documentation files to NuGet packages (improved intellisense support) [#36](https://github.com/NEventStore/NEventStore.Persistence.SQL/issues/36)
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ SQL Persistence Engine for NEventStore

NEventStore.Persistence.Sql currently supports:

- .net framework 4.6.1
- .net framework 4.6.2
- .net standard 2.0
- .net 5.0
- .net 6.0
- MsSql
- SqlLite
- MySql
Expand Down Expand Up @@ -57,6 +55,18 @@ To build the project locally on a Windows Machine:
- Optional: update `.\src\.nuget\NEventStore.Persistence.Sql.nuspec` file if needed (before creating relase packages).
- Open a Powershell console in Administrative mode and run the build script `build.ps1` in the root of the repository.

## How to Run Unit Tests (locally)

- Install Database engines or use Docker to run them in a container (you can use the scripts in `./docker` folder).
- Define the following environment variables:

```
NEventStore.MsSql="Server=localhost,50001;Database=NEventStore;User Id=sa;Password=Password1;"
NEventStore.MySql="Server=localhost;Port=50003;Database=NEventStore;Uid=sa;Pwd=Password1;AutoEnlist=false;"
NEventStore.PostgreSql="Server=localhost;Port=50004;Database=NEventStore;Uid=sa;Pwd=Password1;Enlist=false;"
NEventStore.Oracle="Data Source=localhost:1521/XE;User Id=system;Password=Password1;Persist Security Info=True;"
```

## How to contribute

### Git-Flow
Expand Down
2 changes: 1 addition & 1 deletion dependencies/NEventStore
Submodule NEventStore updated 31 files
+12 −0 .config/dotnet-tools.json
+10 −0 Changelog.md
+2 −53 GitVersion.yml
+1 −1 appveyor.yml
+3 −4 build.ps1
+13 −4 readme.markdown
+1 −1 src/NEventStore.Benchmark/Benchmarks/PersistenceBenchmarks.cs
+7 −7 src/NEventStore.Benchmark/NEventStore.Benchmark.csproj
+1 −1 src/NEventStore.Benchmark/Support/EventStoreHelpers.cs
+1 −1 src/NEventStore.Example/MainProgram.cs
+9 −9 src/NEventStore.Example/NEventStore.Example.csproj
+4 −4 src/NEventStore.Persistence.AcceptanceTests/NEventStore.Persistence.AcceptanceTests.Core.csproj
+2 −2 src/NEventStore.Persistence.AcceptanceTests/PersistenceTests.cs
+1 −1 src/NEventStore.PollingClient/NEventStore.PollingClient.csproj
+1 −1 src/NEventStore.PollingClientExample/MainProgram.cs
+9 −9 src/NEventStore.PollingClientExample/NEventStore.PollingClientExample.csproj
+6 −6 src/NEventStore.Serialization.Binary.Tests/NEventStore.Serialization.Binary.Core.Tests.csproj
+6 −6 src/NEventStore.Serialization.Bson.Tests/NEventStore.Serialization.Bson.Core.Tests.csproj
+2 −2 src/NEventStore.Serialization.Bson/NEventStore.Serialization.Bson.Core.csproj
+6 −6 src/NEventStore.Serialization.Gzip.Tests/NEventStore.Serialization.GZip.Core.Tests.csproj
+6 −6 src/NEventStore.Serialization.Json.Tests/NEventStore.Serialization.Json.Core.Tests.csproj
+2 −2 src/NEventStore.Serialization.Json/NEventStore.Serialization.Json.Core.csproj
+6 −6 src/NEventStore.Serialization.Rijndael.Tests/NEventStore.Serialization.Rijndael.Core.Tests.csproj
+10 −10 src/NEventStore.Tests/NEventStore.Core.Tests.csproj
+1 −1 src/NEventStore/Diagnostics/PerformanceCounterPersistenceEngine.cs
+1 −1 src/NEventStore/Diagnostics/PerformanceCounters.cs
+1 −1 src/NEventStore/Messages.Designer.cs
+2 −2 src/NEventStore/NEventStore.Core.csproj
+3 −3 src/NEventStore/PersistenceWireup.cs
+1 −1 src/NEventStore/Resources.Designer.cs
+1 −1 src/NEventStore/Serialization/Messages.Designer.cs
2 changes: 1 addition & 1 deletion docker/docker-compose.ci.linux.db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
mysql:
container_name: nesci-mysql-1
platform: linux
image: mysql:5.7
image: mysql:8.0 #5.7
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.ci.windows.db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
mysql:
container_name: nesci-mysql-1
platform: windows
image: mysql:5.7
image: mysql:8.0 #5.7
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net7.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NEventStore.Persistence.MsSql.Tests</AssemblyName>
Expand All @@ -14,16 +14,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class PersistenceEngineFixture

public PersistenceEngineFixture()
{
#if NET461
#if NET462
_createPersistence = pageSize =>
new SqlPersistenceFactory(new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient"),
new BinarySerializer(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Transactions;
using FluentAssertions;
#if NET461
#if NET462
using NEventStore.Diagnostics;
#endif
using NEventStore.Persistence.AcceptanceTests.BDD;
Expand Down Expand Up @@ -123,7 +123,7 @@ public class IsolationLevelPersistenceEngineFixture
public IsolationLevelPersistenceEngineFixture()
{
_recorder = new IsolationLevelRecorder();
#if NET461
#if NET462
_connectionFactory = new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient");
#else
_connectionFactory = new EnviromentConnectionFactory("MsSql", System.Data.SqlClient.SqlClientFactory.Instance);
Expand All @@ -141,7 +141,7 @@ public void Initialize()
_persistence.Drop();
_persistence.Dispose();
}
#if NET461
#if NET462
_persistence = new PerformanceCounterPersistenceEngine(_createPersistence(), "tests");
#else
_persistence = _createPersistence();
Expand Down
2 changes: 1 addition & 1 deletion src/NEventStore.Persistence.MsSql.Tests/WireupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void Context()
{
_eventStore = Wireup
.Init()
#if NET461
#if NET462
.UsingSqlPersistence(new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient"))
#else
.UsingSqlPersistence(new EnviromentConnectionFactory("MsSql", System.Data.SqlClient.SqlClientFactory.Instance))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net7.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NEventStore.Persistence.MySql.Tests</AssemblyName>
Expand All @@ -14,17 +14,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.0.27" />
<PackageReference Include="MySql.Data" Version="8.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Data" />
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class PersistenceEngineFixture
{
public PersistenceEngineFixture()
{
#if NET461
#if NET462
_createPersistence = pageSize =>
new SqlPersistenceFactory(
new EnviromentConnectionFactory("MySql", "MySql.Data.MySqlClient"),
Expand Down
2 changes: 1 addition & 1 deletion src/NEventStore.Persistence.MySql.Tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.27.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.1.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net7.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NEventStore.Persistence.PostgreSql.Tests</AssemblyName>
Expand All @@ -13,15 +13,15 @@
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">NUNIT</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="6.0.0" />
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="Npgsql" Version="7.0.4" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public PersistenceEngineFixture()
// It will be done when creating the PostgreNpgsql6Dialect dialect
// AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

#if NET461
#if NET462
_createPersistence = pageSize =>
new SqlPersistenceFactory(
new EnviromentConnectionFactory("PostgreSql", "Npgsql"),
Expand Down
1 change: 1 addition & 0 deletions src/NEventStore.Persistence.Sql.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
..\appveyor.yml = ..\appveyor.yml
..\build.ps1 = ..\build.ps1
..\Changelog.md = ..\Changelog.md
.nuget\NEventStore.Persistence.Sql.nuspec = .nuget\NEventStore.Persistence.Sql.nuspec
..\README.md = ..\README.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class EnviromentConnectionFactory : IConnectionFactory
private readonly string _envVarKey;
private readonly DbProviderFactory _dbProviderFactory;

#if NET461
#if NET462
public EnviromentConnectionFactory(string envDatabaseName, string providerInvariantName)
{
_envVarKey = string.Format("NEventStore.{0}", envDatabaseName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net7.0;net462</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NEventStore.Persistence.Sql.Tests</AssemblyName>
<RootNamespace>NEventStore.Persistence.Sql.Tests</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ IsolationLevel transationIsolationLevel
) : base(enlistInAmbientTransaction, transationIsolationLevel, completeTransaction: true)
{ }

#if NET461
#if NET462
// some of these tests fails with a local instance of sql sever
[Fact]
public void should_throw_an_StorageUnavailableException()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// netstandard does not have support for DbFactoryProviders, we need a totally different way to initialize the driver
#if NET461
#if NET462
namespace NEventStore.Persistence.Sql
{
using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>NEventStore.Persistence.Sql</RootNamespace>
<AssemblyName>NEventStore.Persistence.Sql</AssemblyName>
Expand All @@ -27,10 +27,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Configuration" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
StreamIdOriginal varchar(1000) charset utf8 NOT NULL,
StreamRevision int NOT NULL CHECK (StreamRevision &gt; 0),
Items int NOT NULL CHECK (Items &gt; 0),
CommitId binary(16) NOT NULL CHECK (CommitId != 0),
CommitId binary(16) NOT NULL CHECK (CommitId &lt;&gt; 0x00),
CommitSequence int NOT NULL CHECK (CommitSequence &gt; 0),
CommitStamp bigint NOT NULL,
CheckpointNumber bigint AUTO_INCREMENT,
Expand Down
4 changes: 2 additions & 2 deletions src/NEventStore.Persistence.Sql/SqlPersistenceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SqlPersistenceFactory : IPersistenceFactory
private const int DefaultPageSize = 128;
private readonly TransactionScopeOption? _scopeOption;

#if NET461
#if NET462
public SqlPersistenceFactory(
string connectionName,
ISerialize serializer,
Expand Down Expand Up @@ -60,7 +60,7 @@ public virtual IPersistStreams Build()
return new SqlPersistenceEngine(ConnectionFactory, Dialect, Serializer, PageSize, StreamIdHasher, _scopeOption);
}

#if NET461
#if NET462
protected static ISqlDialect ResolveDialect(ConnectionStringSettings settings)
{
string providerName = settings.ProviderName.ToUpperInvariant();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace NEventStore
public static class SqlPersistenceWireupExtensions
{
// netstandard does not have support for DbFactoryProviders, we need a totally different way to initialize the driver
#if NET461
#if NET462
public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, string connectionName)
{
var factory = new ConfigurationConnectionFactory(connectionName);
Expand All @@ -29,7 +29,7 @@ public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, DbPro

public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, IConnectionFactory factory)
{
#if NET461
#if NET462
// init the global seetings if needed
int timeout = 0;
if (int.TryParse(System.Configuration.ConfigurationManager.AppSettings["NEventStore.SqlCommand.Timeout"], out timeout))
Expand Down
6 changes: 3 additions & 3 deletions src/NEventStore.Persistence.Sql/ThreadScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NEventStore.Persistence.Sql

public class ThreadScope<T> : IDisposable where T : class
{
#if NET461
#if NET462
private readonly HttpContext _context = HttpContext.Current;
#endif

Expand Down Expand Up @@ -77,7 +77,7 @@ protected virtual void Dispose(bool disposing)

private T Load()
{
#if NET461
#if NET462
if (_context != null)
{
return _context.Items[_threadKey] as T;
Expand All @@ -88,7 +88,7 @@ private T Load()

private void Store(T value)
{
#if NET461
#if NET462
if (_context != null)
{
_context.Items[_threadKey] = value;
Expand Down
Loading

0 comments on commit ace3571

Please sign in to comment.