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); }
/// <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);
internal sealed override Task <int> DeleteAsync(DbSelectStatement statement, CancellationToken cancellationToken) { return(ExecuteTableEditAsync(statement, GetDeleteCommand, cancellationToken)); }
/// <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);
/// <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)); }
internal abstract Task <int> DeleteAsync(DbSelectStatement statement, CancellationToken cancellationToken);
/// <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);
public SubQueryEliminator(DbSelectStatement selectStatement) { Debug.Assert(selectStatement != null && selectStatement.Model.DataSource.Kind == DataSourceKind.DbQuery); _selectStatement = selectStatement; }