From adf2a672b87d0d7f2b29ec48e2a71f7c3a4701a5 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 1 Jan 2025 18:18:48 +0100 Subject: [PATCH] Restore .NET 8 packages Updated `UseElsaMySql` method to use default `null` values instead of `default` and added a conditional compilation directive for `.NET 9.0`. Also introduced new package versions for targeting `.NET 8.0` and `.NET 9.0` to ensure compatibility and maintainability. --- Directory.Packages.props | 42 +++++++++++++++++++ .../DbContextOptionsBuilder.cs | 13 ++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5a14c8b2a..dd2e28eac 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -110,6 +110,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/DbContextOptionsBuilder.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/DbContextOptionsBuilder.cs index 29af18c12..403d09f77 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/DbContextOptionsBuilder.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/DbContextOptionsBuilder.cs @@ -14,8 +14,12 @@ public static class DbContextOptionsBuilderExtensions /// /// Configures Entity Framework Core with MySQL. /// - public static DbContextOptionsBuilder UseElsaMySql(this DbContextOptionsBuilder builder, Assembly migrationsAssembly, string connectionString, - ElsaDbContextOptions? options = default, ServerVersion? serverVersion = default, Action? configure = default) => + public static DbContextOptionsBuilder UseElsaMySql(this DbContextOptionsBuilder builder, + Assembly migrationsAssembly, + string connectionString, + ElsaDbContextOptions? options = null, + ServerVersion? serverVersion = null, + Action? configure = null) => builder .UseElsaDbContextOptions(options) .UseMySql(connectionString, serverVersion ?? ServerVersion.AutoDetect(connectionString), db => @@ -25,7 +29,10 @@ public static class DbContextOptionsBuilderExtensions .MigrationsHistoryTable(options.GetMigrationsHistoryTableName(), options.GetSchemaName()) .SchemaBehavior(MySqlSchemaBehavior.Ignore) .EnablePrimitiveCollectionsSupport() - .TranslateParameterizedCollectionsToConstants(); +#if NET9_0 + .TranslateParameterizedCollectionsToConstants() +#endif + ; configure?.Invoke(db); });