-
Notifications
You must be signed in to change notification settings - Fork 0
Izayoi.Data.Repository.DbRepositoryBase
IzayoiJiichan edited this page Sep 7, 2024
·
5 revisions
Namespace | Izayoi.Data.Repository |
Assembly | Izayoi.Data.Repository.dll |
Represents a DB repository base.
public abstract class DbRepositoryBase<TData, TKey>
The map class.
The data type of the key column.
Object -> DbRepositoryBase<TData, TKey>
Name | Summary |
---|---|
DbRepositoryBase(IDbDataMapper dbDataMapper, QueryOption queryOption) | Initializes a new instance of the DbRepositoryBase class with the specified dbDataMapper and queryOption. |
DbRepositoryBase(IDbCommandAdapter dbCommandAdapter) | Initializes a new instance of the DbRepositoryBase class with the specified dbCommandAdapter. |
Name | Returns | Summary |
---|---|---|
GetCountAsync(DbConnection dbConnection, CancellationToken cancellationToken) | Task<int> | Gets the count of records. |
FetchAsync(DbConnection dbConnection, TKey id, CancellationToken cancellationToken) | Task<TData?> | Gets the data for the specified ID. |
FetchAsync(DbConnection dbConnection, IEnumerable<TKey> ids, CancellationToken cancellationToken) | Task<List<TData>> | Gets the data for the specified IDs. |
FetchAllAsync(DbConnection dbConnection, CancellationToken cancellationToken) | Task<List<TData>> | Gets all the data. |
InsertAsync(DbConnection dbConnection, TData data, CancellationToken cancellationToken) | Task<int> | Executes an INSERT query. |
InsertReturnAsync(DbConnection dbConnection, TData data, CancellationToken cancellationToken) | Task<int> | Execute the INSERT query, get the inserted identity value, and set it in the data. |
UpdateAsync(DbConnection dbConnection, TData data, CancellationToken cancellationToken) | Task<int> | Executes an UPDATE query. |
DeleteAsync(DbConnection dbConnection, TKey id, CancellationToken cancellationToken) | Task<int> | Executes a DELETE query. |
DeleteAsync(DbConnection dbConnection, TData data, CancellationToken cancellationToken) | Task<int> | Executes a DELETE query. |
GetCommandTimeout(int queryType) | int | Get command timeout. |
SetCommandTimeout(int queryType, int timeout) | void | Set command timeout. |
This Base does not support transactions, so if you want to support transactions, create your own Base.
Product | Versions |
---|---|
.NET | 8 |
- Izayoi.Data
- Izayoi.Data.Query
- Izayoi.Data.Repository
- Izayoi.Data.Validation
Examples