Skip to content

Commit 2772357

Browse files
authored
Merge pull request #1361 from RohrerF/master
Upgrade MongoDB driver to 3.4.0
2 parents 35a104a + b580279 commit 2772357

File tree

7 files changed

+32
-35
lines changed

7 files changed

+32
-35
lines changed

.github/workflows/dotnet.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
uses: actions/setup-dotnet@v1
1616
with:
1717
dotnet-version: |
18-
3.1.x
1918
6.0.x
2019
8.0.x
20+
9.0.x
2121
- name: Restore dependencies
2222
run: dotnet restore
2323
- name: Build
@@ -31,10 +31,10 @@ jobs:
3131
- name: Setup .NET
3232
uses: actions/setup-dotnet@v1
3333
with:
34-
dotnet-version: |
35-
3.1.x
34+
dotnet-version: |
3635
6.0.x
3736
8.0.x
37+
9.0.x
3838
- name: Restore dependencies
3939
run: dotnet restore
4040
- name: Build
@@ -48,10 +48,10 @@ jobs:
4848
- name: Setup .NET
4949
uses: actions/setup-dotnet@v1
5050
with:
51-
dotnet-version: |
52-
3.1.x
51+
dotnet-version: |
5352
6.0.x
5453
8.0.x
54+
9.0.x
5555
- name: Restore dependencies
5656
run: dotnet restore
5757
- name: Build
@@ -65,10 +65,10 @@ jobs:
6565
- name: Setup .NET
6666
uses: actions/setup-dotnet@v1
6767
with:
68-
dotnet-version: |
69-
3.1.x
68+
dotnet-version: |
7069
6.0.x
7170
8.0.x
71+
9.0.x
7272
- name: Restore dependencies
7373
run: dotnet restore
7474
- name: Build
@@ -82,10 +82,10 @@ jobs:
8282
- name: Setup .NET
8383
uses: actions/setup-dotnet@v1
8484
with:
85-
dotnet-version: |
86-
3.1.x
85+
dotnet-version: |
8786
6.0.x
8887
8.0.x
88+
9.0.x
8989
- name: Restore dependencies
9090
run: dotnet restore
9191
- name: Build
@@ -99,10 +99,10 @@ jobs:
9999
- name: Setup .NET
100100
uses: actions/setup-dotnet@v1
101101
with:
102-
dotnet-version: |
103-
3.1.x
102+
dotnet-version: |
104103
6.0.x
105104
8.0.x
105+
9.0.x
106106
- name: Restore dependencies
107107
run: dotnet restore
108108
- name: Build
@@ -114,10 +114,9 @@ jobs:
114114
steps:
115115
- uses: actions/checkout@v4
116116
- name: Setup .NET
117-
uses: actions/setup-dotnet@v4
117+
uses: actions/setup-dotnet@v1
118118
with:
119-
dotnet-version: |
120-
3.1.x
119+
dotnet-version: |
121120
6.0.x
122121
8.0.x
123122
9.0.x
@@ -134,10 +133,10 @@ jobs:
134133
- name: Setup .NET
135134
uses: actions/setup-dotnet@v1
136135
with:
137-
dotnet-version: |
138-
3.1.x
136+
dotnet-version: |
139137
6.0.x
140138
8.0.x
139+
9.0.x
141140
- name: Restore dependencies
142141
run: dotnet restore
143142
- name: Build

src/providers/WorkflowCore.Persistence.MongoDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ By default (to maintain backwards compatibility), the state object is serialized
2424
This approach has some limitations, for example you cannot control which types will be used in MongoDB for particular fields and you cannot use basic types that are not present in JSON (decimal, timestamp, etc).
2525

2626
To eliminate these limitations, you can use a direct object -> BSON serialization and utilize all serialization possibilities that MongoDb driver provides. You can read more in the [MongoDb CSharp documentation](https://mongodb.github.io/mongo-csharp-driver/1.11/serialization/).
27-
To enable direct serilization you need to register a class map for you state class somewhere in your startup process before you run `WorkflowHost`.
27+
To enable direct serialization you need to register a class map for you state class somewhere in your startup process before you run `WorkflowHost`.
2828

2929
```C#
3030
private void RunWorkflow()

src/providers/WorkflowCore.Persistence.MongoDB/Services/MongoPersistenceProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public async Task<IEnumerable<WorkflowInstance>> GetWorkflowInstances(IEnumerabl
197197

198198
public async Task<IEnumerable<WorkflowInstance>> GetWorkflowInstances(WorkflowStatus? status, string type, DateTime? createdFrom, DateTime? createdTo, int skip, int take)
199199
{
200-
IMongoQueryable<WorkflowInstance> result = WorkflowInstances.AsQueryable();
200+
IQueryable<WorkflowInstance> result = WorkflowInstances.AsQueryable();
201201

202202
if (status.HasValue)
203203
result = result.Where(x => x.Status == status.Value);

src/providers/WorkflowCore.Persistence.MongoDB/WorkflowCore.Persistence.MongoDB.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<AssemblyTitle>Workflow Core MongoDB Persistence Provider</AssemblyTitle>
55
<Authors>Daniel Gerlag</Authors>
6-
<TargetFramework>netstandard2.0</TargetFramework>
6+
<TargetFramework>netstandard2.1</TargetFramework>
77
<AssemblyName>WorkflowCore.Persistence.MongoDB</AssemblyName>
88
<PackageId>WorkflowCore.Persistence.MongoDB</PackageId>
99
<PackageTags>workflow;.NET;Core;state machine;WorkflowCore;MongoDB;Mongo</PackageTags>
@@ -22,7 +22,7 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
25+
<PackageReference Include="MongoDB.Driver" Version="3.4.0" />
2626
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2727
</ItemGroup>
2828

test/Directory.Build.props

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0"/>
10-
<PackageReference Include="xunit" Version="2.4.1"/>
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"/>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
10+
<PackageReference Include="xunit" Version="2.9.2" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
1212
<PackageReference Include="FluentAssertions" Version="4.19.4" />
1313
<PackageReference Include="Moq" Version="4.7.145" />
1414
<PackageReference Include="FakeItEasy" Version="4.9.2" />
15-
</ItemGroup>
16-
17-
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
18-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.2" />
19-
</ItemGroup>
20-
21-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net9.0'">
2215
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
2316
</ItemGroup>
2417
</Project>

test/WorkflowCore.Tests.MongoDB/MongoDockerSetup.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
using System;
22
using System.Threading.Tasks;
33
using MongoDB.Bson;
4+
using MongoDB.Bson.Serialization;
5+
using MongoDB.Bson.Serialization.Serializers;
46
using Squadron;
7+
using WorkflowCore.UnitTests;
58
using Xunit;
69

710
namespace WorkflowCore.Tests.MongoDB
811
{
912
public class MongoDockerSetup : IAsyncLifetime
1013
{
11-
private readonly MongoResource _mongoResource;
14+
private readonly MongoReplicaSetResource _mongoResource;
1215
public static string ConnectionString { get; set; }
1316

1417
public MongoDockerSetup()
1518
{
16-
_mongoResource = new MongoResource();
19+
_mongoResource = new MongoReplicaSetResource();
1720
}
1821

1922
public async Task InitializeAsync()
2023
{
2124
await _mongoResource.InitializeAsync();
2225
ConnectionString = _mongoResource.ConnectionString;
26+
BsonSerializer.TryRegisterSerializer(new ObjectSerializer(type =>
27+
ObjectSerializer.DefaultAllowedTypes(type) || type.FullName.StartsWith("WorkflowCore.")));
2328
}
2429

2530
public Task DisposeAsync()

test/WorkflowCore.Tests.MongoDB/WorkflowCore.Tests.MongoDB.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
88
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
99
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
10-
<TargetFrameworks>net6.0</TargetFrameworks>
10+
<TargetFrameworks>net8.0</TargetFrameworks>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
@@ -21,8 +21,8 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Squadron.Mongo" Version="0.17.0" />
25-
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
24+
<PackageReference Include="Squadron.Mongo" Version="0.24.0" />
25+
<PackageReference Include="MongoDB.Driver" Version="3.4.0" />
2626
</ItemGroup>
2727

2828
</Project>

0 commit comments

Comments
 (0)