示例#1
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());
     }
 }
示例#2
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());
     }
 }