Skip to content

Commit

Permalink
#46 query splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
JimKerslake committed Mar 30, 2023
1 parent 75ca65c commit 7f9b388
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class DesignTimeFactory : IDesignTimeDbContextFactory<PwaDbContext>
public PwaDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<PwaDbContext>();
builder.UseSqlServer("Server=(local);Database=DATABASENAME;Trusted_Connection=True;MultipleActiveResultSets=true");
builder.UseSqlServer("Server=(local);Database=DATABASENAME;Trusted_Connection=True;MultipleActiveResultSets=true",
o => o.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery));

return new PwaDbContext(builder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static IServiceCollection AddPwaStorageMSSQL(
options.UseSqlServer(connectionString,
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);

if (maxConnectionRetryCount > 0)
{
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Microsoft SqlServer storage for cloudscribe.PwaKit</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageTags>pwa,serviceworker,cloudscribe</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static IServiceCollection AddPwaStorageMySql(
{
services.AddPwaStorageEFCommon();

services.AddEntityFrameworkMySql()
services //.AddEntityFrameworkMySql()
.AddDbContext<PwaDbContext>(options =>
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), // breaking change in Net5.0
mySqlOptionsAction: sqlOptions =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>MySql storage for cloudscribe.PwaKit</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageTags>pwa,serviceworker,cloudscribe</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class DesignTimeFactory : IDesignTimeDbContextFactory<PwaDbContext>
public PwaDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<PwaDbContext>();
builder.UseNpgsql("server=yourservername;UID=yourdatabaseusername;PWD=yourdatabaseuserpassword;database=yourdatabasename");
builder.UseNpgsql("server=yourservername;UID=yourdatabaseusername;PWD=yourdatabaseuserpassword;database=yourdatabasename",
o => o.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery));

return new PwaDbContext(builder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ public static IServiceCollection AddPwaStoragePostgreSql(
{
services.AddPwaStorageEFCommon();

services.AddEntityFrameworkNpgsql()
services //.AddEntityFrameworkNpgsql()
.AddDbContext<PwaDbContext>(options =>
options.UseNpgsql(connectionString,
npgsqlOptionsAction: sqlOptions =>
{
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);

if (maxConnectionRetryCount > 0)
{
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>PostgreSql storage for cloudscribe.PwaKit</Description>
<Version>6.0.3</Version>
<Version>6.0.4</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageTags>pwa,serviceworker,cloudscribe</PackageTags>
Expand Down

0 comments on commit 7f9b388

Please sign in to comment.