protected override void OnExecutionTokenPrepared(ExecutionTokenPreparedEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e), $"{nameof(e)} is null."); } var token = e.ExecutionToken as SqlServerCommandExecutionToken; if (token == null) { throw new NotSupportedException($"This type of command builder does not support SQL Dependency, which is required for the {nameof(NotifyChangeAppender<TResult>)}."); } token.AddChangeListener(m_EventHandler); }
/// <summary> /// Override this if you want to examine or modify the execution token before the DBCommand object is built. /// </summary> /// <param name="e">The <see cref="ExecutionTokenPreparedEventArgs"/> instance containing the event data.</param> protected virtual void OnExecutionTokenPrepared(ExecutionTokenPreparedEventArgs e) { }
void PreviousLink_ExecutionTokenPrepared(object?sender, ExecutionTokenPreparedEventArgs e) { OnExecutionTokenPrepared(e); //left first ExecutionTokenPrepared?.Invoke(this, e); //then right e.ExecutionToken.CommandBuilt += ExecutionToken_CommandBuilt; }
/// <summary> /// Raises the <see cref="ExecutionTokenPrepared" /> event. /// </summary> /// <param name="e">The <see cref="ExecutionTokenPreparedEventArgs"/> instance containing the event data.</param> protected void OnExecutionTokenPrepared(ExecutionTokenPreparedEventArgs e) { ExecutionTokenPrepared?.Invoke(this, e); }
void OnExecutionTokenPrepared(object?sender, ExecutionTokenPreparedEventArgs e) { ExecutionTokenPrepared?.Invoke(sender, e); }