diff --git a/Base/XBaseDtoProvider.cs b/Base/XBaseDtoProvider.cs index de2c6b5..31a0e3d 100644 --- a/Base/XBaseDtoProvider.cs +++ b/Base/XBaseDtoProvider.cs @@ -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; } + /// + /// retrieve all exists Dtos + /// as Async Enumerable ... + /// + /// + /// + /// + /// + /// + public virtual async IAsyncEnumerable GetAllAsAsyncEnumerable( + bool ignoreSoftDeleteds = true, + Func, IOrderedQueryable> orderBuilder = null, + Func, IIncludableQueryable> 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; + } + } + /// /// find an Item by providing a Conditional Expression ... /// diff --git a/Interfaces/IXBaseDtoProvider.cs b/Interfaces/IXBaseDtoProvider.cs index 4ceda24..a4e2704 100644 --- a/Interfaces/IXBaseDtoProvider.cs +++ b/Interfaces/IXBaseDtoProvider.cs @@ -133,6 +133,22 @@ namespace xPushService.Interfaces CancellationToken cancellationToken = default ); + /// + /// retrieve all exists Dtos + /// as Async Enumerable ... + /// + /// + /// + /// + /// + /// + IAsyncEnumerable GetAllAsAsyncEnumerable( + bool ignoreSoftDeleteds = true, + Func, IOrderedQueryable> orderBuilder = null, + Func, IIncludableQueryable> includeBuilder = null, + CancellationToken cancellationToken = default + ); + /// /// find an Item by providing a Conditional Expression ... /// diff --git a/xPushService.csproj b/xPushService.csproj index 9f172a6..d729a95 100644 --- a/xPushService.csproj +++ b/xPushService.csproj @@ -2,11 +2,12 @@ 1.0.0 - 8.0 + 12.0 Hadi Khazaee Asl SaherElm IT Center xDashboard.xPushService netstandard2.0 + it is a Part of xDashboard Projects on SaherElm IT Center which provides all required models and actions in related to