From 6273d2b45e0f5a6bc5021cc9f76e7625931ee6a9 Mon Sep 17 00:00:00 2001 From: artem-dudarev Date: Fri, 6 Sep 2024 18:28:42 +0200 Subject: [PATCH 1/2] Update platform to use SqlServer.CompatibilityLevel --- .editorconfig | 2 +- .../VirtoCommerce.OrdersModule2.Web.csproj | 4 +- .../VirtoCommerce.OrdersModule.Core.csproj | 2 +- .../DbContextOptionsBuilderExtensions.cs | 14 ---- .../MySqlDataAssemblyMarker.cs | 5 ++ .../MySqlDbContextFactory.cs | 2 +- ...rtoCommerce.OrdersModule.Data.MySql.csproj | 4 +- .../DbContextOptionsBuilderExtensions.cs | 14 ---- .../PostgreSqlDataAssemblyMarker.cs | 5 ++ .../PostgreSqlDbContextFactory.cs | 2 +- ...mmerce.OrdersModule.Data.PostgreSql.csproj | 4 +- .../DbContextOptionsBuilderExtensions.cs | 16 ----- .../SqlServerDataAssemblyMarker.cs | 5 ++ .../SqlServerDbContextFactory.cs | 2 +- ...ommerce.OrdersModule.Data.SqlServer.csproj | 4 +- .../VirtoCommerce.OrdersModule.Data.csproj | 4 +- .../Controllers/Api/OrderModuleController.cs | 2 +- src/VirtoCommerce.OrdersModule.Web/Module.cs | 9 ++- .../module.manifest | 72 ++++++++++--------- 19 files changed, 74 insertions(+), 98 deletions(-) delete mode 100644 src/VirtoCommerce.OrdersModule.Data.MySql/DbContextOptionsBuilderExtensions.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDataAssemblyMarker.cs delete mode 100644 src/VirtoCommerce.OrdersModule.Data.PostgreSql/DbContextOptionsBuilderExtensions.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDataAssemblyMarker.cs delete mode 100644 src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDataAssemblyMarker.cs diff --git a/.editorconfig b/.editorconfig index 52a5b14d..d467f1b2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -102,7 +102,7 @@ csharp_preserve_single_line_statements = false csharp_preserve_single_line_blocks = true csharp_using_directive_placement = outside_namespace:silent csharp_prefer_simple_using_statement = true:suggestion -csharp_style_namespace_declarations = block_scoped:silent +csharp_style_namespace_declarations = file_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_prefer_top_level_statements = true:silent csharp_style_expression_bodied_lambdas = true:silent diff --git a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj index 954ee60e..b5588e6a 100644 --- a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj +++ b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj @@ -5,11 +5,11 @@ Library - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index 74517b8b..644d806c 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/DbContextOptionsBuilderExtensions.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/DbContextOptionsBuilderExtensions.cs deleted file mode 100644 index 2c79eca1..00000000 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/DbContextOptionsBuilderExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace VirtoCommerce.OrdersModule.Data.MySql -{ - public static class DbContextOptionsBuilderExtensions - { - /// - /// Configures the context to use PostgreSql. - /// - public static DbContextOptionsBuilder UseMySqlDatabase(this DbContextOptionsBuilder builder, string connectionString) => - builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), db => db - .MigrationsAssembly(typeof(MySqlDbContextFactory).Assembly.GetName().Name)); - } -} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDataAssemblyMarker.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDataAssemblyMarker.cs new file mode 100644 index 00000000..b61d8d2b --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDataAssemblyMarker.cs @@ -0,0 +1,5 @@ +namespace VirtoCommerce.OrdersModule.Data.MySql; + +public class MySqlDataAssemblyMarker +{ +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDbContextFactory.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDbContextFactory.cs index 94b79d23..08605a58 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDbContextFactory.cs +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDbContextFactory.cs @@ -16,7 +16,7 @@ public OrderDbContext CreateDbContext(string[] args) connectionString, ResolveServerVersion(serverVersion, connectionString), db => db - .MigrationsAssembly(typeof(MySqlDbContextFactory).Assembly.GetName().Name)); + .MigrationsAssembly(typeof(MySqlDataAssemblyMarker).Assembly.GetName().Name)); return new OrderDbContext(builder.Options); } diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj index b4bef8d0..63347a0b 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj @@ -5,11 +5,11 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/DbContextOptionsBuilderExtensions.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/DbContextOptionsBuilderExtensions.cs deleted file mode 100644 index b6ae9f78..00000000 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/DbContextOptionsBuilderExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace VirtoCommerce.OrdersModule.Data.PostgreSql -{ - public static class DbContextOptionsBuilderExtensions - { - /// - /// Configures the context to use PostgreSql. - /// - public static DbContextOptionsBuilder UsePostgreSqlDatabase(this DbContextOptionsBuilder builder, string connectionString) => - builder.UseNpgsql(connectionString, db => db - .MigrationsAssembly(typeof(PostgreSqlDbContextFactory).Assembly.GetName().Name)); - } -} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDataAssemblyMarker.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDataAssemblyMarker.cs new file mode 100644 index 00000000..ce54a1b2 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDataAssemblyMarker.cs @@ -0,0 +1,5 @@ +namespace VirtoCommerce.OrdersModule.Data.PostgreSql; + +public class PostgreSqlDataAssemblyMarker +{ +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDbContextFactory.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDbContextFactory.cs index da45d662..3e54c912 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDbContextFactory.cs +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDbContextFactory.cs @@ -13,7 +13,7 @@ public OrderDbContext CreateDbContext(string[] args) builder.UseNpgsql( connectionString, - db => db.MigrationsAssembly(typeof(PostgreSqlDbContextFactory).Assembly.GetName().Name)); + db => db.MigrationsAssembly(typeof(PostgreSqlDataAssemblyMarker).Assembly.GetName().Name)); return new OrderDbContext(builder.Options); } diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj index c14cb1eb..679b2475 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj @@ -4,11 +4,11 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs deleted file mode 100644 index b8f7c62f..00000000 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace VirtoCommerce.OrdersModule.Data.SqlServer -{ - public static class DbContextOptionsBuilderExtensions - { - /// - /// Configures the context to use SqlServer. - /// - public static DbContextOptionsBuilder UseSqlServerDatabase(this DbContextOptionsBuilder builder, string connectionString) - { - return builder.UseSqlServer(connectionString, db => db - .MigrationsAssembly(typeof(SqlServerDbContextFactory).Assembly.GetName().Name)); - } - } -} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDataAssemblyMarker.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDataAssemblyMarker.cs new file mode 100644 index 00000000..69d745f3 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDataAssemblyMarker.cs @@ -0,0 +1,5 @@ +namespace VirtoCommerce.OrdersModule.Data.SqlServer; + +public class SqlServerDataAssemblyMarker +{ +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDbContextFactory.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDbContextFactory.cs index af30dc94..ae016fd0 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDbContextFactory.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDbContextFactory.cs @@ -13,7 +13,7 @@ public OrderDbContext CreateDbContext(string[] args) builder.UseSqlServer( connectionString, - db => db.MigrationsAssembly(typeof(SqlServerDbContextFactory).Assembly.GetName().Name)); + db => db.MigrationsAssembly(typeof(SqlServerDataAssemblyMarker).Assembly.GetName().Name)); return new OrderDbContext(builder.Options); } diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj index 270b9ada..2a45f554 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj @@ -5,11 +5,11 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj index c58de163..f0604908 100644 --- a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj +++ b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj @@ -18,8 +18,8 @@ - - + + diff --git a/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs b/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs index 14b08cbb..659a7a1e 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs +++ b/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs @@ -321,7 +321,7 @@ public async Task> CreateOrderFromCart(string cartId { CustomerOrder retVal; - using (await AsyncLock.GetLockByKey(cartId).GetReleaserAsync()) + using (await AsyncLock.GetLockByKey(cartId).LockAsync()) { var cart = await _cartService.GetByIdAsync(cartId); retVal = await _customerOrderBuilder.PlaceCustomerOrderFromCartAsync(cart); diff --git a/src/VirtoCommerce.OrdersModule.Web/Module.cs b/src/VirtoCommerce.OrdersModule.Web/Module.cs index 4f71f969..a79354f9 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Module.cs +++ b/src/VirtoCommerce.OrdersModule.Web/Module.cs @@ -40,6 +40,9 @@ using VirtoCommerce.Platform.Core.Security; using VirtoCommerce.Platform.Core.Settings; using VirtoCommerce.Platform.Data.Extensions; +using VirtoCommerce.Platform.Data.MySql.Extensions; +using VirtoCommerce.Platform.Data.PostgreSql.Extensions; +using VirtoCommerce.Platform.Data.SqlServer.Extensions; using VirtoCommerce.SearchModule.Core.Model; using VirtoCommerce.SearchModule.Core.Services; using VirtoCommerce.StoreModule.Core.Model; @@ -64,13 +67,13 @@ public void Initialize(IServiceCollection serviceCollection) switch (databaseProvider) { case "MySql": - options.UseMySqlDatabase(connectionString); + options.UseMySqlDatabase(connectionString, typeof(MySqlDataAssemblyMarker), Configuration); break; case "PostgreSql": - options.UsePostgreSqlDatabase(connectionString); + options.UsePostgreSqlDatabase(connectionString, typeof(PostgreSqlDataAssemblyMarker), Configuration); break; default: - options.UseSqlServerDatabase(connectionString); + options.UseSqlServerDatabase(connectionString, typeof(SqlServerDataAssemblyMarker), Configuration); break; } }); diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index e8f2b139..ee22011f 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -1,38 +1,40 @@ - VirtoCommerce.Orders - 3.826.0 - - 3.825.0 - - - - - - - - - - - - - Order Management - Document based flexible order management system - - Virto Commerce - - - Virto Commerce - - https://virtocommerce.com/apps/extensions/virto-orders-module - Modules/$(VirtoCommerce.Orders)/Content/logo.png - false - Copyright © 2011-2024 Virto Commerce. All rights reserved - order system - VirtoCommerce.OrdersModule.Web.dll - VirtoCommerce.OrdersModule.Web.Module, VirtoCommerce.OrdersModule.Web - - commerce - - false + VirtoCommerce.Orders + 3.826.0 + + + 3.851.0-alpha.12972-vcst-1752 + + + + + + + + + + + + + + Order Management + Document based flexible order management system + + Virto Commerce + + + Virto Commerce + + https://virtocommerce.com/apps/extensions/virto-orders-module + Modules/$(VirtoCommerce.Orders)/Content/logo.png + false + Copyright © 2011-2024 Virto Commerce. All rights reserved + order system + VirtoCommerce.OrdersModule.Web.dll + VirtoCommerce.OrdersModule.Web.Module, VirtoCommerce.OrdersModule.Web + + commerce + + false From c378293ffc6d8b448bf0dc2ebd70fd3302b76a13 Mon Sep 17 00:00:00 2001 From: artem-dudarev Date: Fri, 13 Sep 2024 11:45:12 +0200 Subject: [PATCH 2/2] Update dependencies --- .../VirtoCommerce.OrdersModule2.Web.csproj | 2 +- .../VirtoCommerce.OrdersModule.Core.csproj | 2 +- ...rtoCommerce.OrdersModule.Data.MySql.csproj | 2 +- ...mmerce.OrdersModule.Data.PostgreSql.csproj | 2 +- ...ommerce.OrdersModule.Data.SqlServer.csproj | 2 +- .../VirtoCommerce.OrdersModule.Data.csproj | 4 +- .../module.manifest | 70 +++++++++---------- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj index b5588e6a..68cbcb4d 100644 --- a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj +++ b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj @@ -9,7 +9,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index 644d806c..960716e3 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj index 63347a0b..b8597525 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj @@ -9,7 +9,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj index 679b2475..a4e39e9a 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj @@ -8,7 +8,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj index 2a45f554..c72adda0 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj @@ -9,7 +9,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj index f0604908..ca00d56b 100644 --- a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj +++ b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj @@ -18,8 +18,8 @@ - - + + diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index ee22011f..78ae71d3 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -1,40 +1,40 @@ - VirtoCommerce.Orders - 3.826.0 - + VirtoCommerce.Orders + 3.826.0 + - 3.851.0-alpha.12972-vcst-1752 - - - - - - - - - - - - + 3.851.0 + + + + + + + + + + + + - Order Management - Document based flexible order management system - - Virto Commerce - - - Virto Commerce - - https://virtocommerce.com/apps/extensions/virto-orders-module - Modules/$(VirtoCommerce.Orders)/Content/logo.png - false - Copyright © 2011-2024 Virto Commerce. All rights reserved - order system - VirtoCommerce.OrdersModule.Web.dll - VirtoCommerce.OrdersModule.Web.Module, VirtoCommerce.OrdersModule.Web - - commerce - - false + Order Management + Document based flexible order management system + + Virto Commerce + + + Virto Commerce + + https://virtocommerce.com/apps/extensions/virto-orders-module + Modules/$(VirtoCommerce.Orders)/Content/logo.png + false + Copyright © 2011-2024 Virto Commerce. All rights reserved + order system + VirtoCommerce.OrdersModule.Web.dll + VirtoCommerce.OrdersModule.Web.Module, VirtoCommerce.OrdersModule.Web + + commerce + + false