Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlDependency async support #2412

Open
davhdavh opened this issue Mar 18, 2024 · 1 comment
Open

SqlDependency async support #2412

davhdavh opened this issue Mar 18, 2024 · 1 comment
Labels
💡 Enhancement New feature request 🙌 Up-for-Grabs Anyone interested in working on it can ask to be assigned

Comments

@davhdavh
Copy link

Is your feature request related to a problem? Please describe.

SqlDependency was designed before async was a thing, and it therefore quite hard to work with in a loop.

Describe the solution you'd like

while(!stoppingToken.IsCancellationRequested) {
  var command = ...;
  var dependency = new AsyncSqlDependency(command, ...);
  var whatever = await ProcessResult(command, stoppingToken);
  bool falseIfTimeout = await dependency.AwaitDependencyChange(TimeSpan.FromMinutes(1), stoppingToken);
}

Describe alternatives you've considered

It is possible to make an implementation with TaskCompletionSource, but would be so much nicer if it was part of the API.

Additional context

One of the hard things to understand when working with SqlDependency is WHEN the dependency is calculated from. The existing implementation is able to call the callback before the ProcessResult finished, so in worst case you can have an unlimited of queries ongoing, while it keeps giving you notifications about changes. This is especially a problem, if the ProcessResult update the underlying data, and thus triggers it over and over.

@JRahnama JRahnama added 💡 Enhancement New feature request untriaged labels Mar 18, 2024
@JRahnama JRahnama added this to Needs triage in SqlClient Triage Board via automation Mar 18, 2024
@DavoudEshtehari DavoudEshtehari moved this from Needs triage to Ideas for Future in SqlClient Triage Board Mar 26, 2024
@DavoudEshtehari DavoudEshtehari added the 🙌 Up-for-Grabs Anyone interested in working on it can ask to be assigned label Mar 26, 2024
@DavoudEshtehari
Copy link
Member

Thanks for bringing this feature to our attention. It's open to grab with contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Enhancement New feature request 🙌 Up-for-Grabs Anyone interested in working on it can ask to be assigned
Projects
SqlClient Triage Board
  
Ideas for Future
Development

No branches or pull requests

3 participants