Interface IDBGetUtils
public interface IDBGetUtils
Methods
- Get(string, object?[]?)
Executes a read-only query and returns the first row. Throws if there are no rows.
- GetAll(string, object?[]?)
Executes a read-only query and returns all rows.
- GetAll<T>(string, object?[]?)
Executes a read-only query and returns all rows, mapped using
T.FromRow.
- GetAll<T>(string, object?[]?, SqlMapper<T>)
Executes a read-only query and returns all rows, mapped using
mapper.
- GetOptional(string, object?[]?)
Executes a read-only query and returns the first row, or null if there are no rows.
- GetOptional<T>(string, object?[]?)
Executes a read-only query and returns the first row mapped using
T.FromRow, ordefault(T)if there are no rows. Note thatdefault(T)is not null if T is a value type.
- GetOptional<T>(string, object?[]?, SqlMapper<T>)
Executes a read-only query and returns the first row mapped using
mapper, ordefault(T)if there are no rows. Note thatdefault(T)is not null for all types. Map to a nullable type (e.g.row => (long?)row.GetLong("id")) to ensure you get null.
- Get<T>(string, object?[]?)
Executes a read-only query and returns the first row mapped using
T.FromRow. Throws if there are no rows.
- Get<T>(string, object?[]?, SqlMapper<T>)
Executes a read-only query and returns the first row mapped using
mapper. Throws if there are no rows.