using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore.Query; using xDataService.Configuration; using xDataService.Interfaces; using xIdentityService.Interfaces; using xModels.Base; using xModels.Dtos; using xPushService.Base; namespace xPushService.Interfaces { /// /// a Provider is a way to Manipulate Data using Repository or Services and Contains Push /// notifications ability ... /// /// /// /// public interface IXBaseProvider where TEntity : XBaseEntity where TDto : XBaseEntityDto { // #region Props ... // IXIdentityProvider IdentityProvider { get; } XDataServiceConfiguration DataConfiguration { get; } IHubContext> Hub { get; } IXBaseRepositoryService RepositoryService { get; } #endregion // #region Actions ... /// /// add a new Dto ... /// /// /// /// /// /// Task AddAsync( TDto item, bool saveChanges = true, string connectionId = null, CancellationToken cancellationToken = default ); /// /// Update an Dto values ... /// /// /// /// /// /// /// Task UpdateAsync( TKey id, TDto item, bool saveChanges = true, string connectionId = null, CancellationToken cancellationToken = default ); /// /// remove an Dto by it's Id ... /// /// /// /// /// /// /// Task RemoveAsync( TKey id, bool softDelete = true, bool saveChanges = true, string connectionId = null, CancellationToken cancellationToken = default ); /// /// count all exists Dtos ... /// /// /// /// Task CountAsync( bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// Check a Dto exists or not ... /// /// /// /// /// Task IsExistsAsync( TKey id, bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// retrieve an Dto by it's Id ... /// /// /// /// /// /// Task GetAsync( TKey id, bool ignoreSoftDeleteds = true, Func, IIncludableQueryable> includeBuilder = null, CancellationToken cancellationToken = default ); /// /// retrieve all exists Dtos ... /// /// /// /// /// /// Task> GetAllAsync( bool ignoreSoftDeleteds = true, Func, IOrderedQueryable> orderBuilder = null, Func, IIncludableQueryable> includeBuilder = null, CancellationToken cancellationToken = default ); /// /// find an Dto by providing a Conditional Expression ... /// /// /// /// /// /// Task FindOneAsync( Expression> predicate, bool ignoreSoftDeleteds = true, Func, IIncludableQueryable> includeBuilder = null, CancellationToken cancellationToken = default ); /// /// find a collection of Dtos by proving a Conditional Expression ... /// /// /// /// /// /// /// Task> FindManyAsync( Expression> predicate, bool ignoreSoftDeleteds = true, Func, IOrderedQueryable> orderBuilder = null, Func, IIncludableQueryable> includeBuilder = null, CancellationToken cancellationToken = default ); /// /// retrieve Dtos based on XQuery Pagination structure ... /// /// /// /// /// /// /// /// Task> QueryAsync( XQuery query, bool ignoreSoftDeleteds = true, Expression> predicate = null, Func, IOrderedQueryable> orderBuilder = null, Func, IIncludableQueryable> includeBuilder = null, CancellationToken cancellationToken = default ); #endregion // #region Hub Actions ... /// /// Send Custom Push Message ... /// /// /// /// /// /// Task SendPush( string action, string payLoad, string connectionId = null, CancellationToken cancellationToken = default ); #endregion } }