Skip to content

Izayoi.Data.DbCommandAdapter

IzayoiJiichan edited this page Aug 14, 2024 · 4 revisions

DbCommandAdapter

Definition

Namespace Izayoi.Data
Assembly Izayoi.Data.DbCommandAdapter.dll

Represents a DB command adapter.

public class DbCommandAdapter : IDbCommandAdapter

Inheritance

Object -> DbCommandAdapter

Constructors

Name Summary
DbCommandAdapter(DbDataMapper dbDataMapper) Initializes a new instance of the DbCommandAdapter class with the specified dbDataMapper.
DbCommandAdapter(DbDataMapper dbDataMapper, QueryOption queryOption) Initializes a new instance of the DbCommandAdapter class with the specified dbDataMapper and queryOption.

Properties

QueryOption QueryOption

Gets the query option.

Methods (Build Command)

Name Returns Summary
BuildDeleteCommand(DbCommand dbCommand, Delete delete) bool Builds a DELETE query for the specified DB command using specified delete source.
BuildDeleteCommand<T>(DbCommand dbCommand, T data) bool Builds a DELETE query for the specified DB command using specified data.
BuildInsertCommand(DbCommand dbCommand, Insert insert) bool Builds an INSERT query for the specified DB command using specified insert source.
BuildInsertCommand<T>(DbCommand dbCommand, T data, bool excludeKey = false) bool Builds an INSERT query for the specified DB command using specified data.
BuildSelectCommand(DbCommand dbCommand, Select select) bool Builds a SELECT query for the specified DB command using specified select source.
BuildUpdateCommand(DbCommand dbCommand, Update update) bool Builds an UPDATE query for the specified DB command using specified update source.
BuildUpdateCommand<T>(DbCommand dbCommand, T data, string[]? excludeColumns = null) bool Builds an UPDATE query for the specified DB command using specified data.

Methods (Execute)

Name Returns Summary
ExecuteQueryAsync<T>(DbCommand dbCommand, CancellationToken cancellationToken) Task<List<T>> Executes specified DB command, and returns the records.
ExecuteScalar<T>(DbCommand dbCommand) T? Executes specified DB command, and returns the first columns of the first row in the first returned result set.
ExecuteScalarAsync<T>(DbCommand dbCommand, CancellationToken cancellationToken) Task<T?> Executes specified DB command, and returns the first columns of the first row in the first returned result set.
ExecuteScalarAsync<T>(DbCommand dbCommand, Select select, CancellationToken cancellationToken) Task<T?> Executes specified DB command using specified select source, and returns the first columns of the first row in the first returned result set.

Methods (Select)

Name Returns Summary
SelectAllAsync<T>(DbCommand dbCommand, CancellationToken cancellationToken) Task<List<T>> Executes a SELECT ALL query for the specified DB command, and returns the records.
SelectAsync<T>(DbCommand dbCommand, Select select, CancellationToken cancellationToken) Task<List<T>> Executes a SELECT query for the specified DB command using specified select source, and returns the records.

Methods (Insert)

Name Returns Summary
InsertAsync<T>(DbCommand dbCommand, T data, CancellationToken cancellationToken) Task<int> Executes an INSERT query for the specified DB command using specified data.
InsertAsync<T>(DbCommand dbCommand, T data, bool excludeKey, CancellationToken cancellationToken) Task<int> Executes an INSERT query for the specified DB command using specified data.
InsertAsync(DbCommand dbCommand, Insert insert, CancellationToken cancellationToken) Task<int> Builds an INSERT query for the specified DB command using specified insert source.
InsertReturnAsync<TReturn, TData>(DbCommand dbCommand, TData data, CancellationToken cancellationToken) Task<TReturn?> Executes an INSERT query for the specified DB command using specified data, and returns an inserted identity value.
InsertReturnAsync<TReturn, TData>(DbCommand dbCommand, TData data, bool excludeKey, CancellationToken cancellationToken) Task<TReturn?> Executes an INSERT query for the specified DB command using specified data, and returns an inserted identity value.
InsertReturnAsync<T>(DbCommand dbCommand, Insert insert, CancellationToken cancellationToken) Task<T?> Executes an INSERT query for the specified DB command using specified insert source, and returns an inserted identity value.
InsertReturnAsync<T>(DbCommand dbCommand, Insert insert, string returnColumnName, CancellationToken cancellationToken) Task<T?> Executes an INSERT query for the specified DB command using specified insert source, and returns an inserted specified returnColumnName value.
InsertReturnAsync<TReturn, TData>(DbCommand dbCommand, TData data, string returnColumnName, CancellationToken cancellationToken) Task<TReturn?> Executes an INSERT query for the specified DB command using specified data, and returns an inserted specified returnColumnName value.

Methods (Update)

Name Returns Summary
UpdateAsync(DbCommand dbCommand, Update update, CancellationToken cancellationToken) Task<int> Executes an UPDATE query for the specified DB command using specified update source.
UpdateAsync<T>(DbCommand dbCommand, T data, CancellationToken cancellationToken) Task<int> Executes an UPDATE query for the specified DB command using specified data.
UpdateAsync<T>(DbCommand dbCommand, T data, string[] excludeColumns, CancellationToken cancellationToken) Task<int> Executes an UPDATE query for the specified DB command using specified data.

Methods (Delete)

Name Returns Summary
DeleteAsync(DbCommand dbCommand, Delete delete, CancellationToken cancellationToken) Task<int> Executes a DELETE query for the specified DB command using specified delete source.
DeleteAsync<T>(DbCommand dbCommand, T data, CancellationToken cancellationToken) Task<int> Executes a DELETE query for the specified DB command using specified data.

Remarks

A DbCommandAdapter object can be reused. (Recommend)

Examples

Example.DbCommandAdapter

Applies to

Product Versions
.NET 8
Clone this wiki locally