From e58eb70c71cb4cc2f4fbd569e5135c5920ab53f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=B5=20=CE=9D=CE=B9=CE=93=CE=9E=CE=97=CE=9B=CF=88=CE=9A?= Date: Thu, 21 Nov 2024 20:20:03 +0530 Subject: [PATCH] `v24` release --- .github/workflows/publish-to-nuget.yml | 2 +- Benchmark/Benchmark.csproj | 2 +- MongoDB.Entities/MongoDB.Entities.csproj | 2 +- Tests/Init.cs | 8 ++++---- Tests/TestDatabase.cs | 8 ++++---- Tests/Tests.csproj | 12 ++++++------ changelog.md | 7 ++++++- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml index 24b09168..338fab80 100644 --- a/.github/workflows/publish-to-nuget.yml +++ b/.github/workflows/publish-to-nuget.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .Net SDK uses: actions/setup-dotnet@v2 with: - dotnet-version: 8.x + dotnet-version: 9.x - name: Make Nuget Packages run: dotnet pack MongoDB.Entities/MongoDB.Entities.csproj -c Release diff --git a/Benchmark/Benchmark.csproj b/Benchmark/Benchmark.csproj index 04b0d8e2..d8efb38d 100644 --- a/Benchmark/Benchmark.csproj +++ b/Benchmark/Benchmark.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 enable diff --git a/MongoDB.Entities/MongoDB.Entities.csproj b/MongoDB.Entities/MongoDB.Entities.csproj index 9e9568f6..1b25476d 100644 --- a/MongoDB.Entities/MongoDB.Entities.csproj +++ b/MongoDB.Entities/MongoDB.Entities.csproj @@ -2,7 +2,7 @@ - 23.2.0.1-beta + 24.0.0 netstandard2.1 MongoDB.Entities diff --git a/Tests/Init.cs b/Tests/Init.cs index 4ea8b710..5d88f4aa 100644 --- a/Tests/Init.cs +++ b/Tests/Init.cs @@ -11,16 +11,16 @@ namespace MongoDB.Entities.Tests; public static class InitTest { static MongoClientSettings ClientSettings { get; set; } - static bool UseTestContainers; + static bool _useTestContainers; [AssemblyInitialize] public static async Task Init(TestContext _) { BsonSerializer.RegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); - UseTestContainers = System.Environment.GetEnvironmentVariable("MONGODB_ENTITIES_TESTCONTAINERS") != null; + _useTestContainers = System.Environment.GetEnvironmentVariable("MONGODB_ENTITIES_TESTCONTAINERS") != null; - if (UseTestContainers) + if (_useTestContainers) { var testContainer = await TestDatabase.CreateDatabase(); ClientSettings = MongoClientSettings.FromConnectionString(testContainer.GetConnectionString()); @@ -31,7 +31,7 @@ public static async Task Init(TestContext _) public static async Task InitTestDatabase(string databaseName) { - if (UseTestContainers) + if (_useTestContainers) await DB.InitAsync(databaseName, ClientSettings); else await DB.InitAsync(databaseName); diff --git a/Tests/TestDatabase.cs b/Tests/TestDatabase.cs index 330ec2df..33052f92 100644 --- a/Tests/TestDatabase.cs +++ b/Tests/TestDatabase.cs @@ -4,12 +4,13 @@ public static class TestDatabase { - private static SemaphoreSlim _semaphore = new(1, 1); + private static readonly SemaphoreSlim _semaphore = new(1, 1); private static MongoDbContainer? _testContainer; public static async Task CreateDatabase() { await _semaphore.WaitAsync(); + try { var database = await CreateTestDatabase(); @@ -25,9 +26,8 @@ public static async Task CreateDatabase() private static async Task CreateTestDatabase() { if (_testContainer != null) - { return _testContainer; - } + _testContainer = new MongoDbBuilder() .WithPortBinding(27017) .WithPassword("username") @@ -36,7 +36,7 @@ private static async Task CreateTestDatabase() .Build(); await _testContainer.StartAsync(); - + return _testContainer; } } \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 097ae271..2e1626f1 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false MongoDB.Entities.Tests MongoDB.Entities.Tests @@ -10,11 +10,11 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/changelog.md b/changelog.md index 6d2dc2a2..25c9790a 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,11 @@ - upgrade to mongodb driver v3.0 -[//]: # (### IMPROVEMENTS) +> should be a pretty straightforward upgrade unless you're affected by any of the points mentioned in the driver [v3 upgrade guide](https://www.mongodb.com/docs/drivers/csharp/v3.0/upgrade/v3/). + +### IMPROVEMENTS + +- upgrade build pipeline to .net 9.0 +- upgrade project dependencies to latest [//]: # (### BREAKING CHANGES) \ No newline at end of file