Skip to content

Commit

Permalink
VCST-1752: Fix performance degradation on SQL Server (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev authored Sep 12, 2024
1 parent 179c2e3 commit e882b0c
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.ExportModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.SearchModule.Core" Version="3.800.0" />
</ItemGroup>
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace VirtoCommerce.CatalogModule.Data.MySql;

public class MySqlDataAssemblyMarker
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public CatalogDbContext CreateDbContext(string[] args)
connectionString,
ResolveServerVersion(serverVersion, connectionString),
db => db
.MigrationsAssembly(typeof(MySqlDbContextFactory).Assembly.GetName().Name));
.MigrationsAssembly(typeof(MySqlDataAssemblyMarker).Assembly.GetName().Name));

return new CatalogDbContext(builder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.851.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.CatalogModule.Data\VirtoCommerce.CatalogModule.Data.csproj" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace VirtoCommerce.CatalogModule.Data.PostgreSql;

public class PostgreSqlDataAssemblyMarker
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CatalogDbContext CreateDbContext(string[] args)

builder.UseNpgsql(
connectionString,
db => db.MigrationsAssembly(typeof(PostgreSqlDbContextFactory).Assembly.GetName().Name));
db => db.MigrationsAssembly(typeof(PostgreSqlDataAssemblyMarker).Assembly.GetName().Name));

return new CatalogDbContext(builder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.851.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.CatalogModule.Data\VirtoCommerce.CatalogModule.Data.csproj" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace VirtoCommerce.CatalogModule.Data.SqlServer;

public class SqlServerDataAssemblyMarker
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CatalogDbContext CreateDbContext(string[] args)

builder.UseSqlServer(
connectionString,
db => db.MigrationsAssembly(typeof(SqlServerDbContextFactory).Assembly.GetName().Name));
db => db.MigrationsAssembly(typeof(SqlServerDataAssemblyMarker).Assembly.GetName().Name));

return new CatalogDbContext(builder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>warnings</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.851.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.CatalogModule.Data\VirtoCommerce.CatalogModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.8.1" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.64.0.3205" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.AssetsModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.ExportModule.Data" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.StoreModule.Core" Version="3.800.0" />
</ItemGroup>
<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/VirtoCommerce.CatalogModule.Web/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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.Platform.Security.Authorization;
using VirtoCommerce.SearchModule.Core.Model;
using VirtoCommerce.SearchModule.Core.Services;
Expand Down Expand Up @@ -81,13 +84,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;
}
});
Expand Down
4 changes: 3 additions & 1 deletion src/VirtoCommerce.CatalogModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<id>VirtoCommerce.Catalog</id>
<version>3.817.0</version>
<version-tag />
<platformVersion>3.825.0</platformVersion>

<platformVersion>3.851.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Assets" version="3.800.0" />
<dependency id="VirtoCommerce.BulkActionsModule" version="3.800.0" optional="true" />
Expand All @@ -12,6 +13,7 @@
<dependency id="VirtoCommerce.Search" version="3.800.0" />
<dependency id="VirtoCommerce.Store" version="3.800.0" />
</dependencies>

<title>Catalog</title>
<description>Easily manage your products, categories, variations, and properties</description>
<authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="VirtoCommerce.Testing" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Testing" Version="3.851.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.console" Version="2.6.2">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit e882b0c

Please sign in to comment.