Skip to content

Commit

Permalink
VCST-1752: Fix performance degradation on SQL Server (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev authored Sep 13, 2024
1 parent 62cfe31 commit f1fc7fd
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.851.0" />
</ItemGroup>
</Project>

This file was deleted.

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

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

return new PricingDbContext(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.MySql" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.851.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.PricingModule.Data\VirtoCommerce.PricingModule.Data.csproj" />
Expand Down

This file was deleted.

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

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

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

return new PricingDbContext(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.PricingModule.Data\VirtoCommerce.PricingModule.Data.csproj" />
Expand Down

This file was deleted.

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

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

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

return new PricingDbContext(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.SqlServer" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.851.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.PricingModule.Data\VirtoCommerce.PricingModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.ExportModule.Data" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" 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.Security" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.SearchModule.Data" Version="3.800.0" />
</ItemGroup>
<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/VirtoCommerce.PricingModule.Web/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
using VirtoCommerce.Platform.Core.Settings;
using VirtoCommerce.Platform.Core.Settings.Events;
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.PricingModule.Core;
using VirtoCommerce.PricingModule.Core.Events;
Expand Down Expand Up @@ -61,13 +64,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.PricingModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
<id>VirtoCommerce.Pricing</id>
<version>3.808.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.Catalog" version="3.800.0" />
<dependency id="VirtoCommerce.Core" version="3.800.0" />
<dependency id="VirtoCommerce.Export" version="3.800.0" optional="true" />
<dependency id="VirtoCommerce.Search" version="3.800.0" />
</dependencies>

<title>Pricing</title>
<description>Robust pricing management functionality based on price list and dynamic evaluation</description>
<authors>
Expand Down

0 comments on commit f1fc7fd

Please sign in to comment.