diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs index b8f7c62f..77be77e9 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/DbContextOptionsBuilderExtensions.cs @@ -7,10 +7,11 @@ public static class DbContextOptionsBuilderExtensions /// /// Configures the context to use SqlServer. /// - public static DbContextOptionsBuilder UseSqlServerDatabase(this DbContextOptionsBuilder builder, string connectionString) + public static DbContextOptionsBuilder UseSqlServerDatabase(this DbContextOptionsBuilder builder, string connectionString, int compatibilityLevel) { return builder.UseSqlServer(connectionString, db => db - .MigrationsAssembly(typeof(SqlServerDbContextFactory).Assembly.GetName().Name)); + .MigrationsAssembly(typeof(SqlServerDbContextFactory).Assembly.GetName().Name) + .UseCompatibilityLevel(compatibilityLevel)); } } } diff --git a/src/VirtoCommerce.OrdersModule.Web/Module.cs b/src/VirtoCommerce.OrdersModule.Web/Module.cs index 4f71f969..267feb1a 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Module.cs +++ b/src/VirtoCommerce.OrdersModule.Web/Module.cs @@ -70,7 +70,8 @@ public void Initialize(IServiceCollection serviceCollection) options.UsePostgreSqlDatabase(connectionString); break; default: - options.UseSqlServerDatabase(connectionString); + var compatibilityLevel = Configuration.GetValue("SqlServer:CompatibilityLevel", 120); + options.UseSqlServerDatabase(connectionString, compatibilityLevel); break; } });