Skip to content

IPocoHandlers Interface ​

Definition ​

Provides POCO-oriented data access operations for a database session.

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Methods ​

NameDescription
Task<Nullable<decimal>> AverageAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the average of the specified property for rows matching the optional predicate.
Task<int> BulkInsertAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a list of records using provider-specific bulk techniques.
Task<int> BulkInsertAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a list of records using provider-specific bulk techniques and a runtime entity type.
Task<int> BulkUpdateAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Updates a list of existing rows using provider-specific bulk techniques.
Task<int> BulkUpdateAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Updates a list of existing rows using provider-specific bulk techniques and a runtime entity type.
Task<long> CountAsync(IPredicateNode query = null)Returns the count of records matching the optional predicate.
Task<long> CountAsync(Type entityType, IPredicateNode query = null)Returns the count of records matching the optional predicate for a runtime entity type.
Task<bool> DeleteAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a record using the entity primary key value.
Task<bool> DeleteAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a record using a runtime entity type and instance.
Task<bool> DeleteByPkAsync(Type entityType, object id, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a record by primary key value using a runtime entity type.
Task<bool> DeleteByPkAsync(object id, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a record by primary key value.
Task<int> DeleteListAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a list of records using each item's primary key value.
Task<int> DeleteListAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a list of records using a runtime entity type and each item's primary key value.
Task<int> DeleteListByPkAsync(IEnumerable<object> ids, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a list of records by primary key values.
Task<int> DeleteListByPkAsync(Type entityType, IEnumerable<object> ids, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)Deletes a list of records by primary key values using a runtime entity type.
Task<T> FirstOrDefault(QueryBuilder<T> query, CancellationToken cancellationToken = null)Returns the first record matching the provided query, or null if no rows match.
Task<T> GetByPkAsync(object id, CancellationToken cancellationToken = null)Fetches a record by primary key value, or null if no row matches.
Task<object> GetByPkAsync(Type entityType, object id, CancellationToken cancellationToken = null)Fetches a record by primary key value using a runtime entity type.
Task<List<T>> GetListAsync(QueryBuilder<T> query, CancellationToken cancellationToken = null)Executes the specified query and returns a materialized list of results. Empty list when no rows match (never null on success).
Task<List<T>> GetListAsync(SelectStatement statement, CancellationToken cancellationToken = null)Executes a parameterized SelectStatement and returns a materialized list of results. Empty list when no rows match (never null on success).
Task<List<T>> GetListAsync(string statement, IReadOnlyList<IParameter> parameters = null, CancellationToken cancellationToken = null)Executes caller-provided SQL text and returns a materialized list of results. Empty list when no rows match (never null on success).
IAsyncEnumerable<T> GetListStream(QueryBuilder<T> query, CancellationToken cancellationToken = null)Executes the specified query and returns an asynchronous stream of results.
Task<bool> InsertAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a single record into the corresponding table.
Task<bool> InsertAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a single record using a runtime entity type.
Task<int> InsertListAsync(IEnumerable<T> list, int commitInterval = null, bool useTransaction = null, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a list of records into the corresponding table.
Task<int> InsertListAsync(Type entityType, IEnumerable list, int commitInterval = null, bool useTransaction = null, int commandTimeout = null, CancellationToken cancellationToken = null)Inserts a list of records into the corresponding table using a runtime entity type.
Task<Nullable<decimal>> MaxAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the maximum value of the specified property for rows matching the optional predicate.
Task<TResult> MaxAsync(Expression<Func<T, TResult>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the maximum value of the specified property for rows matching the optional predicate.
Task<Nullable<decimal>> MinAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the minimum value of the specified property for rows matching the optional predicate.
Task<TResult> MinAsync(Expression<Func<T, TResult>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the minimum value of the specified property for rows matching the optional predicate.
QueryBuilder<T> Query()Creates a query builder for the specified entity type.
QueryBuilder<T> Query(Expression<Func<T, bool>> filter)Creates a query builder for the specified entity type with an initial WHERE filter.
Task<bool> SaveAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Alias for UpsertAsync.
Task<bool> SaveAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Alias for the runtime-typed UpsertAsync overload.
Task<int> SaveListAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Alias for UpsertListAsync.
Task<int> SaveListAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Alias for the runtime-typed UpsertListAsync overload.
Task<Nullable<decimal>> SumAsync(Expression<Func<T, object>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the sum of the specified property for rows matching the optional predicate.
Task<TResult> SumAsync(Expression<Func<T, TResult>> property, bool distinct = null, IPredicateNode predicate = null, CancellationToken ct = null)Computes the sum of the specified property for rows matching the optional predicate.
bool Truncate()Executes a TRUNCATE against the underlying table for T.
bool Truncate(Type entityType)Executes a TRUNCATE against the underlying table for the specified runtime entity type.
Task<bool> TruncateAsync()Executes a TRUNCATE against the underlying table for T.
Task<bool> TruncateAsync(Type entityType)Executes a TRUNCATE against the underlying table for the specified runtime entity type.
Task<bool> UpdateAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null)UPDATE an existing record in the database table
Task<bool> UpdateAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null)UPDATE an existing record using a runtime entity type.
Task<int> UpdateListAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)UPDATE a list of existing rows in the database table
Task<int> UpdateListAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null)UPDATE a list of existing rows using a runtime entity type.
Task<bool> UpsertAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a record depending on whether it already exists.
Task<bool> UpsertAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a record using a runtime entity type.
Task<int> UpsertListAsync(IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a list of records depending on whether each primary key already exists.
Task<int> UpsertListAsync(Type entityType, IEnumerable list, int commitInterval = null, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a list of records using a runtime entity type.

Remarks ​

Implementations are expected to translate expressions and query builders into provider-specific SQL, and to materialize results into POCO instances.