Esempio n. 1
0
        private async Task <int> ExecuteTableEditAsync(DbSelectStatement statement, Func <DbSelectStatement, TCommand> getCommand, CancellationToken cancellationToken)
        {
            var command = getCommand(statement);
            var result  = await ExecuteNonQueryAsync(command, cancellationToken);

            if (result != 0)
            {
                statement.Model.DataSource.UpdateRevision();
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the command to delete data from table
 /// </summary>
 /// <param name="statement">The query statement of the DbTable delete.</param>
 /// <returns>The command.</returns>
 protected internal abstract TCommand GetDeleteCommand(DbSelectStatement statement);
Esempio n. 3
0
 internal sealed override Task <int> DeleteAsync(DbSelectStatement statement, CancellationToken cancellationToken)
 {
     return(ExecuteTableEditAsync(statement, GetDeleteCommand, cancellationToken));
 }
Esempio n. 4
0
 /// <summary>
 /// Gets the command to insert data into table.
 /// </summary>
 /// <param name="statement">The query statement of the DbTable insert.</param>
 /// <returns>The command.</returns>
 protected abstract TCommand GetInsertCommand(DbSelectStatement statement);
Esempio n. 5
0
 /// <summary>
 /// Executes UPDATE query statement.
 /// </summary>
 /// <param name="dbTable">The target DbTable.</param>
 /// <param name="statement">The query statement.</param>
 /// <param name="ct">The async cancellation token.</param>
 /// <returns>Number of rows affected.</returns>
 public static Task <int> UpdateAsync(this IDbTable dbTable, DbSelectStatement statement, CancellationToken ct)
 {
     return(dbTable.DbSession.UpdateAsync(statement, ct));
 }
Esempio n. 6
0
 internal abstract Task <int> DeleteAsync(DbSelectStatement statement, CancellationToken cancellationToken);
Esempio n. 7
0
 /// <summary>
 /// Executes query to insert scalar values into table.
 /// </summary>
 /// <param name="statement">The SQL SELECT statement.</param>
 /// <param name="outputIdentity">Specifies whether newly generated identity value should be returned.</param>
 /// <param name="cancellationToken">The async cancellation token.</param>
 /// <returns>The <see cref="InsertScalarResult"/>.</returns>
 protected internal abstract Task <InsertScalarResult> InsertScalarAsync(DbSelectStatement statement, bool outputIdentity, CancellationToken cancellationToken);
Esempio n. 8
0
 public SubQueryEliminator(DbSelectStatement selectStatement)
 {
     Debug.Assert(selectStatement != null && selectStatement.Model.DataSource.Kind == DataSourceKind.DbQuery);
     _selectStatement = selectStatement;
 }