diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5406574..42295ce 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,7 +15,7 @@ jobs: with: dotnet-version: | 6 - 7 + 8 - name: Build, Test and Sonar uses: swisslife-oss/actions/pull-request@main with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 213b9d3..dee4c73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: with: dotnet-version: | 6 - 7 + 8 - name: Restore tools run: dotnet tool restore - name: Build, Test and Sonar diff --git a/Directory.Packages.props b/Directory.Packages.props index a953b83..42793f4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -26,12 +26,12 @@ - - - - - - + + + + + + diff --git a/global.json b/global.json index 77c776f..391ba3c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100", "rollForward": "latestFeature" } } diff --git a/samples/Context/DataAccess/DataAccess.csproj b/samples/Context/DataAccess/DataAccess.csproj index 145a5aa..bc5baf9 100644 --- a/samples/Context/DataAccess/DataAccess.csproj +++ b/samples/Context/DataAccess/DataAccess.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 SimpleBlog.DataAccess SimpleBlog.DataAccess false diff --git a/samples/Context/Domain/Domain.csproj b/samples/Context/Domain/Domain.csproj index 2862d55..2fa17f3 100644 --- a/samples/Context/Domain/Domain.csproj +++ b/samples/Context/Domain/Domain.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 SimpleBlog.Domain SimpleBlog.Domain false @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/samples/Context/Host/Host.csproj b/samples/Context/Host/Host.csproj index 6178047..1ddaf3e 100644 --- a/samples/Context/Host/Host.csproj +++ b/samples/Context/Host/Host.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 fbbac7be-63d2-4849-8dc4-31492a2367a2 Linux ..\.. diff --git a/samples/Context/Host/Startup.cs b/samples/Context/Host/Startup.cs index 7dc6041..f627bc3 100644 --- a/samples/Context/Host/Startup.cs +++ b/samples/Context/Host/Startup.cs @@ -34,7 +34,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) } app.UseOpenApi(); - app.UseSwaggerUi3(); + app.UseSwaggerUi(); app.UseHttpsRedirection(); diff --git a/samples/Context/Models/Models.csproj b/samples/Context/Models/Models.csproj index 34e956e..e37a137 100644 --- a/samples/Context/Models/Models.csproj +++ b/samples/Context/Models/Models.csproj @@ -1,10 +1,10 @@ - net7.0 + net8.0 SimpleBlog.Models SimpleBlog.Models false - \ No newline at end of file + diff --git a/samples/Directory.Packages.props b/samples/Directory.Packages.props index 7a6c695..aa7d63d 100644 --- a/samples/Directory.Packages.props +++ b/samples/Directory.Packages.props @@ -4,7 +4,7 @@ - + diff --git a/src/Context.Tests/Context.Tests.csproj b/src/Context.Tests/Context.Tests.csproj index 4fec853..139dea5 100644 --- a/src/Context.Tests/Context.Tests.csproj +++ b/src/Context.Tests/Context.Tests.csproj @@ -1,7 +1,7 @@ - - + + MongoDB.Extensions.Context.Tests MongoDB.Extensions.Context.Tests @@ -13,7 +13,7 @@ - + diff --git a/src/Context.Tests/MongoCollectionBuilderTests.cs b/src/Context.Tests/MongoCollectionBuilderTests.cs index 2ac1321..1291f5a 100644 --- a/src/Context.Tests/MongoCollectionBuilderTests.cs +++ b/src/Context.Tests/MongoCollectionBuilderTests.cs @@ -126,7 +126,7 @@ public void AddBsonClassMap_AddNewBsonClassMapSeveralTimes_BsonClassMapIsRegiste public void AddBsonClassMap_AddNewBsonClassMapWithoutParameter_BsonClassMapIsRegistered() { // Arrange - var mongoCollectionBuilder = + var mongoCollectionBuilder = new MongoCollectionBuilder(_mongoDatabase); // Act @@ -157,7 +157,7 @@ public void WithMongoCollectionSettings_ChangeCollectionSettings_MongoCollection { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder(_mongoDatabase); - + // Act mongoCollectionBuilder.WithCollectionSettings(mongoCollectionSettings => { @@ -230,7 +230,7 @@ public void WithMongoCollectionConfiguration_ChangeCollectionConfiguration_Mongo IMongoCollection result = mongoCollectionBuilder.Build(); - // + // List indexes = result.Indexes.List().ToList(); Assert.Equal("_id_", indexes.First().GetElement("name").Value.ToString()); Assert.Equal("Name_1", indexes.Last().GetElement("name").Value.ToString(), ignoreCase: true); diff --git a/src/Context/IMongoCollectionBuilder.cs b/src/Context/IMongoCollectionBuilder.cs index e055800..1152a5e 100644 --- a/src/Context/IMongoCollectionBuilder.cs +++ b/src/Context/IMongoCollectionBuilder.cs @@ -8,13 +8,13 @@ public interface IMongoCollectionBuilder { IMongoCollectionBuilder WithCollectionName(string collectionName); - IMongoCollectionBuilder AddBsonClassMap() + IMongoCollectionBuilder AddBsonClassMap() where TMapDocument : class; IMongoCollectionBuilder AddBsonClassMap( - Action> bsonClassMapAction) + Action> bsonClassMapAction) where TMapDocument : class; - + IMongoCollectionBuilder WithCollectionSettings( Action collectionSettings); diff --git a/src/Context/Internal/MongoCollectionBuilder.cs b/src/Context/Internal/MongoCollectionBuilder.cs index 9bf1a33..2a9a334 100644 --- a/src/Context/Internal/MongoCollectionBuilder.cs +++ b/src/Context/Internal/MongoCollectionBuilder.cs @@ -38,16 +38,16 @@ public IMongoCollectionBuilder WithCollectionName(string collectionNa public IMongoCollectionBuilder AddBsonClassMap( Action> bsonClassMapAction) where TMapDocument : class { - _classMapActions.Add(() => + _classMapActions.Add(() => RegisterClassMapSync(bsonClassMapAction)); return this; } - public IMongoCollectionBuilder AddBsonClassMap() + public IMongoCollectionBuilder AddBsonClassMap() where TMapDocument : class { - _classMapActions.Add(() => + _classMapActions.Add(() => RegisterClassMapSync()); return this; @@ -72,7 +72,7 @@ public IMongoCollectionBuilder WithCollectionConfiguration( internal IMongoCollection Build() { _classMapActions.ForEach(action => action()); - + IMongoCollection mongoCollection = GetMongoCollection(); _collectionConfigurations.ForEach(configuration => configuration(mongoCollection)); diff --git a/src/Dependencies.props b/src/Dependencies.props index c2f314f..54ca611 100644 --- a/src/Dependencies.props +++ b/src/Dependencies.props @@ -1,6 +1,6 @@ - net6.0;net7.0 - netstandard2.0;netstandard2.1;net6.0;net7.0 + net6.0;net8.0 + netstandard2.0;netstandard2.1;net6.0;net8.0 diff --git a/src/Migration.Tests/Migration.Tests.csproj b/src/Migration.Tests/Migration.Tests.csproj index 38ae4ef..a1a069b 100644 --- a/src/Migration.Tests/Migration.Tests.csproj +++ b/src/Migration.Tests/Migration.Tests.csproj @@ -4,7 +4,7 @@ Migration.Tests Migration.Tests - net6.0;net7.0 + net6.0;net8.0 diff --git a/src/Migration/Migration.csproj b/src/Migration/Migration.csproj index 8f4f78b..4f49618 100644 --- a/src/Migration/Migration.csproj +++ b/src/Migration/Migration.csproj @@ -5,7 +5,7 @@ MongoDB.Extensions.Migration MongoDB.Extensions.Migration MongoDB.Extensions.Migration - net6.0;net7.0 + net6.0;net8.0