Reference > Configuration > Runtime

Stored Procedure Execution Pipeline Events

core concept: stored procedure execution pipeline

Before Start (Synchronous)

The first event published, it is published before a SQL statement is assembled from the QueryExpression. This event should be used to apply any query-specifics to the QueryExpression that need to be applied immediately after Execute or ExecuteAsync is invoked.

Syntax

OnBeforeStart({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is assembled.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
syntax examples

After Assembly (Synchronous)

Event published after a SQL statement is assembled from the QueryExpression and after all query-specific after assembly subscribers have received the query-specific after assembly event publication.

Syntax

OnAfterAssembly({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

Before Command (Synchronous)

Event published before a command is executed against the database and before the query-specific before command event is published.

Syntax

OnBeforeCommand({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is executed against the database.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

After Command (Synchronous)

Event published after a command is executed against the database and after the query-specific after command event is published.

Subscribe to this event only if you need access to the command after execution of the SQL statement. The command (and any data readers) are still open.

Syntax

OnAfterCommand({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked after a command has been executed.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

After Complete (Synchronous)

Event published after the pipeline has completed all work, this is the last event published.

Syntax

OnAfterComplete({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked after the pipeline has completed all work.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

Before Stored Procedure Start (Synchronous)

The first Stored Procedure-specific event published, it is published before a SQL statement is assembled from the QueryExpression and after all BeforeStart subscribers have received the BeforeStart event publication. This event should be used to apply any query-specifics to the QueryExpression that need to be applied immediately after Execute or ExecuteAsync is invoked on the query.

Syntax

OnBeforeStored ProcedureStart({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is assembled.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
syntax examples

After Stored Procedure Assembly (Synchronous)

Event published after a SQL statement is assembled from the QueryExpression and after all OnAfterAssembly subscribers have received the OnAfterAssembly event publication.

Syntax

OnAfterStoredProcedureAssembly({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

Before Stored Procedure Command (Synchronous)

Event published before a command is executed against the database and after the OnBeforeCommand event was published. This is the last event published before the command is executed against the database.

Syntax

OnBeforeStoredProcedureCommand({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is executed against the database.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

After Stored Procedure Command (Synchronous)

Event published after a command is executed against the database and after the OnAfterCommand event publication.

Subscribe to this event only if you need access to the command after execution of the SQL statement. The command (and any data readers) are still open.

Syntax

OnAfterStoredProcedureCommand({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked after a command has been executed.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

After Stored Procedure Complete (Synchronous)

Event published after a SQL statement has been executed.

Syntax

OnAfterStoredProcedureComplete({action}[,{shouldInvokeAction}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked after the pipeline has completed all work.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.

Before Start (Asynchronous)

Event published before a SQL statement is assembled from the QueryExpression. The parameter builder is available (no parameters have been created). This event should be used to apply any query-specifics to the QueryExpression that need to be applied immediately after Execute or ExecuteAsync is invoked on the query.

Syntax

OnBeforeStart({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is assembled.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.
syntax examples

After Assembly (Asynchronous)

Event published after a SQL statement is assembled from the QueryExpression. Changes made to the QueryExpression will NOT effect the SQL statement. The SQL statement has been assembled and any/all parameters have been created for the SQL statement. The parameter builder is available in this event, and should be used to create/add additional parameters for any additional text appended to the SQL statements command text writer.

Syntax

OnAfterAssembly({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked *after* a SQL statement is assembled.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.
syntax examples

Before Command (Asynchronous)

Event published before a database command is executed against the database. The command text can be overwritten, or the command text writer can have text appended. Parameters have been set on the command prior to this event publication.

Syntax

OnBeforeCommand({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
shouldInvokeAction
cancellationToken

After Command (Asynchronous)

Event published after a command has been executed against the database.

Subscribe to this event only if you need access to the command after execution of the SQL statement. The command (and any data readers) are still open.

Syntax

OnAfterCommand({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked *after* a command has been executed.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.

After Complete (Asynchronous)

The final event published. This is a good event to subscribe to for needs that apply to all queries and they are only published after successful execution of the SQL statement.

Syntax

OnAfterComplete({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.

Before Stored Procedure Start (Asynchronous)

The first Stored Procedure-specific event published, it is published before a SQL statement is assembled from the QueryExpression and after all BeforeStart subscribers have received the BeforeStart event publication. This event should be used to apply any query-specifics to the QueryExpression that need to be applied immediately after Execute or ExecuteAsync is invoked on the query.

Syntax

OnBeforeStoredProcedureStart({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is assembled.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.
syntax examples

After Stored Procedure Assembly (Asynchronous)

Event published after a SQL statement is assembled from the QueryExpression and before the OnAfterAssembly event is published.

Syntax

OnAfterStoredProcedureAssembly({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.

Before Stored Procedure Command (Asynchronous)

Event published before a command is executed against the database and after the OnBeforeCommand event was published. This is the last event published before the command is executed against the database.

Syntax

OnBeforeStoredProcedureCommand({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked before a SQL statement is executed against the database.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.

After Stored Procedure Command (Asynchronous)

Event published after a command is executed against the database and after the OnAfterCommand event publication.

Subscribe to this event only if you need access to the command after execution of the SQL statement. The command (and any data readers) are still open.

Syntax

OnAfterStoredProcedureCommand({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context. The provided delegate is invoked after a command has been executed.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.

After Stored Procedure Complete (Asynchronous)

Event published after a SQL statement has been executed.

Syntax

OnAfterStoredProcedureComplete({action}[,{shouldInvokeAction}][,{cancellationToken}])

Arguments

action
A delegate receiving event-specific context.
shouldInvokeAction
Invoked to determine if `action` should be invoked, a filter on the event subscription.
cancellationToken
A cancellation token that will be checked occassionally as the pipeline progresses. An `OperationCanceledException` will be thrown if the token is cancelled.
Previous
Delete Pipeline Events

© 2024 dbExpression. All rights reserved.