internal static Task GenerateTask <TCommandBuilder>(TCommandBuilder commandBuilder, CancellationToken cancellationToken, object?state)
        where TCommandBuilder : DbCommandBuilder <SqlCommand, SqlParameter>, ISupportsChangeListener
    {
        var materializer = new WaitForChangeMaterializer <TCommandBuilder>(commandBuilder);

        return(materializer.GenerateTask(cancellationToken, state));
    }
 /// <summary>
 /// Waits for change in the data that is returned by this operation.
 /// </summary>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <param name="state">User defined state, usually used for logging.</param>
 /// <returns>Task that can be waited for.</returns>
 /// <remarks>This requires the use of SQL Dependency</remarks>
 public Task WaitForChange(CancellationToken cancellationToken, object?state = null)
 {
     return(WaitForChangeMaterializer.GenerateTask(this, cancellationToken, state));
 }