# Class DbObject OptimaJet.Workflow.MySQL.DbObject Namespace: [OptimaJet.Workflow.MySQL](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/) ```csharp public class DbObject where TEntity : IEntity, new() ``` ## Type Hierarchy - DbObject Current type - [ProcessInstanceTree](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/ProcessInstanceTree/) - [WorkflowApprovalHistory](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowApprovalHistory/) - [WorkflowForm](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL.Models/WorkflowForm/) - [WorkflowGlobalParameter](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowGlobalParameter/) - [WorkflowInbox](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowInbox/) - [WorkflowProcessInstance](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessInstance/) - [WorkflowProcessInstancePersistence](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessInstancePersistence/) - [WorkflowProcessInstanceStatus](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessInstanceStatus/) - [WorkflowProcessScheme](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessScheme/) - [WorkflowProcessTimer](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessTimer/) - [WorkflowProcessTransitionHistory](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowProcessTransitionHistory/) - [WorkflowRuntime](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL.Models/WorkflowRuntime/) - [WorkflowScheme](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/WorkflowScheme/) - [WorkflowSync](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL.Models/WorkflowSync/) ## Constructors `public DbObject(string dbTableName, int commandTimeout)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `dbTableName` | `String` | | | `commandTimeout` | `Int32` | | ## Properties `public int CommandTimeout { get; }` `public string DbTableName { get; }` ## Methods `public virtual Task InsertAsync(MySqlConnection connection, TEntity entity, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `entity` | `{TEntity}` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public virtual Task UpsertAsync(MySqlConnection connection, TEntity entity, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `entity` | `{TEntity}` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public virtual Task UpdateAsync(MySqlConnection connection, TEntity entity, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `entity` | `{TEntity}` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectAllAsync(MySqlConnection connection)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectAllWithPagingAsync(MySqlConnection connection, List<(string parameterName, SortDirection sortDirection)> orderParameters, Paging paging)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `orderParameters` | `List` | | | `paging` | `Paging` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectByAsync(MySqlConnection connection, Expression> selectorLambda, TSelect value)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `selectorLambda` | `Expression` | | | `value` | `{TSelect}` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectByWithPagingAsync(MySqlConnection connection, Expression> selectorLambda, TSelect value, Expression> sortLambda, SortDirection sortDirection, Paging paging)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `selectorLambda` | `Expression` | | | `value` | `{TSelect}` | | | `sortLambda` | `Expression` | | | `sortDirection` | `SortDirection` | | | `paging` | `Paging` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task DeleteByAsync(MySqlConnection connection, Expression> selectorLambda, TSelect value, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `selectorLambda` | `Expression` | | | `value` | `{TSelect}` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectByKeyAsync(MySqlConnection connection, object id)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `id` | `Object` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task DeleteAsync(MySqlConnection connection, object id, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `id` | `Object` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task GetCountAsync(MySqlConnection connection)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task GetCountByAsync(MySqlConnection connection, Expression> selectorLambda, TSelect value, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `selectorLambda` | `Expression` | | | `value` | `{TSelect}` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task ExecuteCommandNonQueryAsync(MySqlConnection connection, string commandText, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task ExecuteCommandNonQueryAsync(MySqlConnection connection, string commandText, MySqlTransaction transaction = null, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `transaction` | `MySqlTransaction` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task ExecuteCommandScalarAsync(MySqlConnection connection, string commandText, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task ExecuteCommandScalarAsync(MySqlConnection connection, string commandText, MySqlTransaction transaction = null, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `transaction` | `MySqlTransaction` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectAsync(MySqlConnection connection, string commandText, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task SelectAsync(MySqlConnection connection, string commandText, MySqlTransaction transaction, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `transaction` | `MySqlTransaction` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task>> SelectAsDictionaryAsync(MySqlConnection connection, string commandText, params MySqlParameter[] parameters)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `commandText` | `String` | | | `parameters` | `MySqlParameter[]` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public Task InsertAllAsync(MySqlConnection connection, TEntity[] values, MySqlTransaction transaction = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `MySqlConnection` | | | `values` | `{TEntity}[]` | | | `transaction` | `MySqlTransaction` | | ### Returns | Type | Description | | --- | --- | | `Task` | | `public virtual MySqlParameter CreateParameter(TEntity entity, ColumnInfo c, string namePrefix = "")` ### Parameters | Name | Type | Description | | --- | --- | --- | | `entity` | `{TEntity}` | | | `c` | `ColumnInfo` | | | `namePrefix` | `String` | | ### Returns | Type | Description | | --- | --- | | `MySqlParameter` | | `protected static object ToDbValue(TValue value, MySqlDbType type)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `value` | `{TValue}` | | | `type` | `MySqlDbType` | | ### Returns | Type | Description | | --- | --- | | `Object` | | `protected static object FromDbValue(TValue dbValue, MySqlDbType type)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `dbValue` | `{TValue}` | | | `type` | `MySqlDbType` | | ### Returns | Type | Description | | --- | --- | | `Object` | | `public string GetKeyOrFirstColumn()` ### Returns | Type | Description | | --- | --- | | `String` | | ## Fields `public static List DBColumnsStatic` `public List DBColumns` [Previous ColumnInfo](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/ColumnInfo/) [Next MySQLProvider](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/MySQLProvider/)