Update Lang Version to 12 ...
Add Support for Get all As Async Enumerable ...
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
@@ -271,6 +272,44 @@ namespace xPushService.Base
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// retrieve all exists Dtos
|
||||
/// as Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <param name="orderBuilder"></param>
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
[EnumeratorCancellation] CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var enumerable = Service.GetAllAsAsyncEnumerable(
|
||||
orderBuilder: orderBuilder,
|
||||
includeBuilder: includeBuilder,
|
||||
cancellationToken: cancellationToken,
|
||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||
);
|
||||
|
||||
//
|
||||
await foreach (var dto in enumerable)
|
||||
{
|
||||
//
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
//
|
||||
yield return dto;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// find an Item by providing a Conditional Expression ...
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user