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 committed Sep 13, 2024
1 parent 6d9d042 commit d8de9c4
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 57 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.832.3" />
</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 @@ -9,7 +9,7 @@
<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.832.3" />
</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 @@ -9,7 +9,7 @@
<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.832.3" />
</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 @@ -9,7 +9,7 @@
<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.832.3" />
</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.832.3" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.832.3" />
<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.804.2</version>
<version-tag />
<platformVersion>3.825.0</platformVersion>

<platformVersion>3.832.3</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 d8de9c4

Please sign in to comment.