public async Task <IEnumerable <TEntity> > WhereAsync(string whereCondition, object param = default, Transaction transaction = default, CancellationToken cancellationToken = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Where <TEntity>(_provider, whereCondition), param: param, transaction: transaction)) { return(await CommandExecuter.ExecuteQueryAsync <TEntity>(_dbConnection, command, cancellationToken)); } }
public async Task <TEntity> FindAsync(object id, Transaction transaction = default, CancellationToken cancellationToken = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Find <TEntity>(_provider, _key), key: _key.Name, id: id, transaction: transaction)) { return((await CommandExecuter.ExecuteQueryAsync <TEntity>(_dbConnection, command, cancellationToken)).FirstOrDefault()); } }
public IEnumerable <TEntity> Where(string whereCondition, object param = default, Transaction transaction = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Where <TEntity>(_provider, whereCondition), param: param, transaction: transaction)) { return(CommandExecuter.ExecuteQuery <TEntity>(_dbConnection, command)); } }
public TEntity Find(object id, Transaction transaction = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Find <TEntity>(_provider, _key), key: _key.Name, id: id, transaction: transaction)) { return(CommandExecuter.ExecuteQuery <TEntity>(_dbConnection, command).FirstOrDefault()); } }
public async Task <IEnumerable <TEntity> > AllAsync(Transaction transaction = default, CancellationToken cancellationToken = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.All <TEntity>(_provider), transaction: transaction)) { return(await CommandExecuter.ExecuteQueryAsync <TEntity>(_dbConnection, command, cancellationToken)); } }
public IEnumerable <TEntity> All(Transaction transaction = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.All <TEntity>(_provider), transaction: transaction)) { return(CommandExecuter.ExecuteQuery <TEntity>(_dbConnection, command)); } }
public async Task DeleteAsync(object id, Transaction transaction = default, CancellationToken cancellationToken = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Delete <TEntity>(_provider, _key), _key.Name, id: id, transaction: transaction)) { await CommandExecuter.ExecuteNonQueryAsync(_dbConnection, command, cancellationToken); } }
public void Delete(object id, Transaction transaction = default) { using (var command = CommandDefinition.GetCommand(provider: _provider, connection: _dbConnection, commandText: DynamicQuery.Delete <TEntity>(_provider, _key), key: _key.Name, id: id, transaction: transaction)) { CommandExecuter.ExecuteNonQuery(_dbConnection, command); } }