Пример #1
0
 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));
     }
 }
Пример #2
0
 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());
     }
 }
Пример #3
0
 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));
     }
 }
Пример #4
0
 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());
     }
 }
Пример #5
0
 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));
     }
 }
Пример #6
0
 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));
     }
 }
Пример #7
0
 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);
     }
 }
Пример #8
0
 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);
     }
 }