Skip to content

Commit cd9b096

Browse files
feat: Compatible with net5.0
1 parent f3042be commit cd9b096

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v1
1818
with:
19-
dotnet-version: 3.1.301
19+
dotnet-version: 5.0.*
2020
- name: Restore dependencies
2121
run: dotnet restore
2222
- name: Build

src/providers/WorkflowCore.Persistence.MySQL/MysqlContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ public MysqlContext(string connectionString, Action<MySqlDbContextOptionsBuilder
2121
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
2222
{
2323
base.OnConfiguring(optionsBuilder);
24+
#if NETSTANDARD2_0
2425
optionsBuilder.UseMySql(_connectionString, _mysqlOptionsAction);
26+
#elif NETSTANDARD2_1_OR_GREATER
27+
optionsBuilder.UseMySql(_connectionString, ServerVersion.AutoDetect(_connectionString), _mysqlOptionsAction);
28+
#endif
2529
}
2630

2731
protected override void ConfigureSubscriptionStorage(EntityTypeBuilder<PersistedSubscription> builder)

src/providers/WorkflowCore.Persistence.MySQL/WorkflowCore.Persistence.MySQL.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyTitle>Workflow Core MySQL Persistence Provider</AssemblyTitle>
55
<VersionPrefix>1.0.0</VersionPrefix>
66
<Authors>Daniel Gerlag</Authors>
7-
<TargetFramework>netstandard2.0</TargetFramework>
7+
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
88
<AssemblyName>WorkflowCore.Persistence.MySQL</AssemblyName>
99
<PackageId>WorkflowCore.Persistence.MySQL</PackageId>
1010
<PackageTags>workflow;.NET;Core;state machine;WorkflowCore;MySQL</PackageTags>
@@ -18,14 +18,22 @@
1818
<Description>Provides support to persist workflows running on Workflow Core to a MySQL database.</Description>
1919
</PropertyGroup>
2020

21-
<ItemGroup>
21+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
2222
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2525
</PackageReference>
2626
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />
2727
</ItemGroup>
2828

29+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
30+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
31+
<PrivateAssets>all</PrivateAssets>
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
33+
</PackageReference>
34+
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
35+
</ItemGroup>
36+
2937
<ItemGroup>
3038
<ProjectReference Include="..\..\WorkflowCore\WorkflowCore.csproj" />
3139
<ProjectReference Include="..\WorkflowCore.Persistence.EntityFramework\WorkflowCore.Persistence.EntityFramework.csproj" />

src/samples/WorkflowCore.Sample04/WorkflowCore.Sample04.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<AssemblyName>WorkflowCore.Sample04</AssemblyName>
66
<OutputType>Exe</OutputType>
7-
<PackageId>WorkflowCore.Sample04</PackageId>
7+
<PackageId>WorkflowCore.Sample04</PackageId>
88
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
99
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1010
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
@@ -25,16 +25,16 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="AWSSDK.SQS" Version="3.3.102.44" />
28-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
29-
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="5.0.1" />
30-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1">
28+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.8" />
29+
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="5.0.8" />
30+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.8">
3131
<PrivateAssets>all</PrivateAssets>
3232
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3333
</PackageReference>
34-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
35-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" />
34+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.8" />
35+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.8" />
3636
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
37-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.1">
37+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.8">
3838
<PrivateAssets>all</PrivateAssets>
3939
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4040
</PackageReference>

test/WorkflowCore.Tests.MySQL/DockerSetup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22
using Docker.Testify;
33
using Xunit;
4-
using MySql.Data.MySqlClient;
54
using System;
5+
using MySqlConnector;
66

77
namespace WorkflowCore.Tests.MySQL
88
{
@@ -13,7 +13,7 @@ public class MysqlDockerSetup : DockerSetup
1313
public static string RootPassword => "rootpwd123";
1414

1515
public override TimeSpan TimeOut => TimeSpan.FromSeconds(60);
16-
16+
1717
public override string ImageName => "mysql";
1818
public override IList<string> EnvironmentVariables => new List<string> {
1919
$"MYSQL_ROOT_PASSWORD={RootPassword}"

0 commit comments

Comments
 (0)