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>
|
||||
|
||||
@@ -133,6 +133,22 @@ namespace xPushService.Interfaces
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <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>
|
||||
IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// find an Item by providing a Conditional Expression ...
|
||||
/// </summary>
|
||||
|
||||
+2
-1
@@ -2,11 +2,12 @@
|
||||
<!-- Runtime Definition -->
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0</Version>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<Authors>Hadi Khazaee Asl</Authors>
|
||||
<Company>SaherElm IT Center</Company>
|
||||
<PackageId>xDashboard.xPushService</PackageId>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
<Description>
|
||||
it is a Part of xDashboard Projects on SaherElm IT Center which provides all required models
|
||||
and actions in related to
|
||||
|
||||
Reference in New Issue
Block a user