Skip to content

Conversation

@LucDeCaf
Copy link
Contributor

@LucDeCaf LucDeCaf commented Jan 27, 2026

A common convention in .NET for managing/cleaning up resources for cancellable operations is to return an IDisposable type. Consumers can then use using var query = ..., which automatically calls query.Dispose() when query leaves scope.

This PR returns an IDisposable from the Watch method which users can use to stop watching queries. The old SQLWatchOptions.Signal approach is still available for users which need the ability to stop watching the query from within the OnResult or OnError callbacks, or who prefer to work with CancellationTokens. Also removes a potential memory caused from never cleaning up a CancellationToken.Register call.

@LucDeCaf LucDeCaf marked this pull request as ready for review January 29, 2026 08:11
@LucDeCaf LucDeCaf merged commit 35cea75 into main Jan 29, 2026
1 check passed
@LucDeCaf LucDeCaf deleted the watch-disposable branch January 29, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants