Skip to content

Commit

Permalink
Merge pull request #37 from cloudscribe/feature/36
Browse files Browse the repository at this point in the history
#36 query splitting
  • Loading branch information
JimKerslake authored Mar 31, 2023
2 parents 66cb885 + 80f1dcd commit c29f70b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public async Task<PagedResult<AuthorizationPolicyInfo>> GetPage(
};

query = query
.AsSingleQuery() // best not to use split queries in association with skip and take
.OrderBy(x => x.Name)
.Select(p => p)
.Skip(offset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageIcon>icon.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL;
using cloudscribe.Versioning;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;

Expand All @@ -24,6 +25,8 @@ public static IServiceCollection AddDynamicPolicyEFStorageMSSQL(
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 All @@ -32,7 +35,11 @@ public static IServiceCollection AddDynamicPolicyEFStorageMSSQL(
maxRetryDelay: TimeSpan.FromSeconds(maxConnectionRetryDelaySeconds),
errorNumbersToAdd: transientSqlErrorNumbersToAdd);
}
}),
})

// how to find query splitting issues....
// .ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))
,
optionsLifetime: ServiceLifetime.Singleton
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>MSSQL Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageIcon>icon.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static IServiceCollection AddDynamicPolicyEFStorageMySql(
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), // breaking change in Net5.0
mySqlOptionsAction: 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>MySql Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageIcon>icon.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static IServiceCollection AddDynamicPolicyPostgreSqlStorage(
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 Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core</Description>
<Version>6.0.0</Version>
<Version>6.0.1</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Joe Audette</Authors>
<PackageIcon>icon.png</PackageIcon>
Expand Down

0 comments on commit c29f70b

Please sign in to comment.