using System; using xModels.Dtos; using System.Linq; using System.Threading; using xIdentityModels.Dtos; using System.Threading.Tasks; using xIdentityModels.Models; using System.Linq.Expressions; using System.Collections.Generic; namespace xIdentityModels.Interfaces { public interface IXScopeProvider { // #region Readers ... /// /// retrieve whole items as queryable ... /// /// a flag for Tracking behaviour /// an Expression for Filter Items ... /// an Order Builder expression for Ordering Query ... /// IQueryable AsQueryable( bool asNoTracking = true, Expression> predicate = null, Func, IOrderedQueryable> orderBuilder = null ); /// /// retrieve an Entity by it's Id ... /// /// /// /// /// Task GetAsync( int id, bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// retrieve all exists Entities ... /// /// /// /// /// Task> GetAllAsync( bool ignoreSoftDeleteds = true, Func, IOrderedQueryable> orderBuilder = null, CancellationToken cancellationToken = default ); /// /// find an Entity by providing a Conditional Expression ... /// /// /// /// /// Task FindOneAsync( Expression> predicate, bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// find a collection of Entities by proving a Conditional Expression ... /// /// /// /// /// /// Task> FindManyAsync( Expression> predicate, bool ignoreSoftDeleteds = true, Func, IOrderedQueryable> orderBuilder = null, CancellationToken cancellationToken = default ); /// /// count all exists Entities ... /// /// /// /// Task CountAsync( bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// count all exists Entities Pages by providing page size ... /// /// /// /// /// /// Task PagesCountAsync( int pageSize, int? totalItems = null, bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// Check an Entity exists or not ... /// /// /// /// /// Task IsExistsAsync( int id, bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); #endregion // #region Query ... /// /// retrieve Entities based on XQuery Pagination structure ... /// /// /// /// /// /// /// Task> QueryAsync( XQuery query, bool ignoreSoftDeleteds = true, Expression> predicate = null, Func, IOrderedQueryable> orderBuilder = null, CancellationToken cancellationToken = default ); #endregion // #region Add/Update/Remove ... /// /// add a new Entity ... /// /// /// /// /// /// Task AddAsync( XScopeDefinitionDto item, bool saveChanges = true, XUserClaimsInfoDto userInfo = null, CancellationToken cancellationToken = default ); /// /// Update an Entity values ... /// /// /// /// /// /// /// Task UpdateAsync( int id, XScopeDefinitionDto item, bool saveChanges = true, XUserClaimsInfoDto userInfo = null, CancellationToken cancellationToken = default ); /// /// remove an Entity by it's Id ... /// /// /// /// /// /// /// Task RemoveAsync( int id, bool softDelete = true, bool saveChanges = true, XUserClaimsInfoDto userInfo = null, CancellationToken cancellationToken = default ); #endregion // #region Custom ... #endregion // #region Enrichers ... /// /// Enrich Item ... /// /// /// /// Task EnrichAsync( XScopeDefinition source, CancellationToken cancellationToken = default ); /// /// Enrich Item ... /// /// /// /// Task EnrichAsync( XScopeDefinitionDto source, CancellationToken cancellationToken = default ); /// /// Enrich a Collection of Items(s) ... /// /// /// /// Task> EnrichRangeAsync( IEnumerable sources, CancellationToken cancellationToken = default ); /// /// Enrich a Collection of Items(s) ... /// /// /// /// Task> EnrichRangeAsync( IEnumerable sources, CancellationToken cancellationToken = default ); #endregion } }