Skip to content

Commit d6375b5

Browse files
committed
#566 query splitting
1 parent a5cfad7 commit d6375b5

File tree

9 files changed

+16
-6
lines changed

9 files changed

+16
-6
lines changed

src/cloudscribe.SimpleContent.Storage.EFCore.Common/ContentHistoryQueries.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public async Task<PagedResult<ContentHistory>> GetByContent(
6161
.Take(pageSize)
6262
;
6363

64-
result.Data = await query.AsNoTracking().ToListAsync<ContentHistory>(cancellationToken).ConfigureAwait(false);
64+
result.Data = await query.AsNoTracking().AsSingleQuery().ToListAsync<ContentHistory>(cancellationToken).ConfigureAwait(false);
6565
result.TotalItems = await _db.ContentHistory
6666
.Where(x =>
6767
x.ProjectId == projectId
@@ -108,7 +108,7 @@ public async Task<PagedResult<ContentHistory>> GetList(
108108
.Take(pageSize)
109109
;
110110

111-
result.Data = await query.AsNoTracking().ToListAsync<ContentHistory>(cancellationToken).ConfigureAwait(false);
111+
result.Data = await query.AsNoTracking().AsSingleQuery().ToListAsync<ContentHistory>(cancellationToken).ConfigureAwait(false);
112112
result.TotalItems = await _db.ContentHistory
113113
.Where(x =>
114114
x.ProjectId == projectId

src/cloudscribe.SimpleContent.Storage.EFCore.Common/PostQueries.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public async Task<PagedPostResult> GetPosts(
165165

166166
var posts = await query
167167
.AsNoTracking()
168+
.AsSingleQuery()
168169
.Skip(offset)
169170
.Take(pageSize)
170171
.ToListAsync<IPost>(cancellationToken)
@@ -336,6 +337,7 @@ public async Task<PagedPostResult> GetPosts(
336337
int offset = (pageSize * pageNumber) - pageSize;
337338
var posts = await query
338339
.AsNoTracking()
340+
.AsSingleQuery()
339341
.Skip(offset)
340342
.Take(pageSize)
341343
.ToListAsync<IPost>();
@@ -453,6 +455,7 @@ public async Task<PostResult> GetPostBySlug(
453455

454456
result.PreviousPost = await db.Posts
455457
.AsNoTracking()
458+
.AsSingleQuery()
456459
.Where(p =>
457460
p.BlogId == blogId
458461
&& p.PubDate < cutoff
@@ -464,6 +467,7 @@ public async Task<PostResult> GetPostBySlug(
464467

465468
result.NextPost = await db.Posts
466469
.AsNoTracking()
470+
.AsSingleQuery()
467471
.Where(p =>
468472
p.BlogId == blogId
469473
&& p.PubDate > cutoff

src/cloudscribe.SimpleContent.Storage.EFCore.Common/cloudscribe.SimpleContent.Storage.EFCore.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>base package - Entity Framework Core implementation of cloudscribe SimpleContent commands and queries</Description>
5-
<Version>6.0.1</Version>
5+
<Version>6.0.2</Version>
66
<TargetFramework>net6.0</TargetFramework>
77
<Authors>Joe Audette</Authors>
88
<PackageTags>cloudscribe;commands;queries;ef</PackageTags>

src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public static IServiceCollection AddCloudscribeSimpleContentEFStorageMSSQL(
3434
optionsBuilder.UseSqlServer(connectionString,
3535
sqlServerOptionsAction: sqlOptions =>
3636
{
37+
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
38+
3739
if (maxConnectionRetryCount > 0)
3840
{
3941
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency

src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/cloudscribe.SimpleContent.Storage.EFCore.MSSQL.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>MSSQL Entity Framework Core implementation of cloudscribe SimpleContent commands and queries</Description>
5-
<Version>6.0.1</Version>
5+
<Version>6.0.2</Version>
66
<TargetFramework>net6.0</TargetFramework>
77
<Authors>Joe Audette</Authors>
88
<PackageTags>cloudscribe;commands;queries;ef</PackageTags>

src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static IServiceCollection AddCloudscribeSimpleContentPostgreSqlStorage(
3333
options.UseNpgsql(connectionString,
3434
npgsqlOptionsAction: sqlOptions =>
3535
{
36+
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
37+
3638
if (maxConnectionRetryCount > 0)
3739
{
3840
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency

src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>PostgreSql Entity Framework Core implementation of cloudscribe SimpleContent commands and queries</Description>
5-
<Version>6.0.2</Version>
5+
<Version>6.0.3</Version>
66
<TargetFramework>net6.0</TargetFramework>
77
<Authors>Joe Audette</Authors>
88
<PackageTags>cloudscribe;commands;queries;ef</PackageTags>

src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public static IServiceCollection AddCloudscribeSimpleContentEFStoragePostgreSql(
3434
options.UseNpgsql(connectionString,
3535
npgsqlOptionsAction: sqlOptions =>
3636
{
37+
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
38+
3739
if (maxConnectionRetryCount > 0)
3840
{
3941
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency

src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/cloudscribe.SimpleContent.Storage.EFCore.pgsql.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>PostgreSql Entity Framework Core implementation of cloudscribe SimpleContent commands and queries</Description>
5-
<Version>6.0.1</Version>
5+
<Version>6.0.2</Version>
66
<TargetFramework>net6.0</TargetFramework>
77
<Authors>Joe Audette</Authors>
88
<PackageTags>cloudscribe;commands;queries;ef</PackageTags>

0 commit comments

Comments
 (0)