Hi,

Is it possible to cancel a running DataObjects.NET query ? For example cancelling it by emitting a SqlCommand.Cancel

Regards, Benoit

asked Mar 28 '18 at 08:40

Benoit%20Nesme's gravatar image

Benoit Nesme
43202024


One Answer:

Hello Benoit Nesme,

Unfortunately, we don't have cancellation of queries for now.

answered Apr 05 '18 at 02:09

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

Hi Alexey, Thanks. So there is no hook in Session object to retrieve the SqlCommand behind ?

(Apr 05 '18 at 04:55) Benoit Nesme Benoit%20Nesme's gravatar image

There are two events where we give access to the actual DbCommand instance of the query - Session.Events.OnCommandExecuting and Session.Events.OnCommandExecuted. The first one is triggered before command starts execution and the second - when command is completed successfully or with error. But I cannot guarantee that everything will work fine if you cancel the DbCommand before OnCommandExecuted has been triggered. According to SqlCommand.Cancel() documentation, results of this operation may vary depending on several factors.

(Apr 05 '18 at 08:00) Alexey Kulakov Alexey%20Kulakov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA