简体   繁体   English

确保DbCommand.Cancel()方法正常运行的最准确方法?

[英]The most accurate way to make sure DbCommand.Cancel() method is working well?

As we know, there's no exception occur on this method. 众所周知,这种方法没有例外。 So I have a solution to make sure that it's working. 因此,我有一个解决方案来确保它能正常工作。

My solution is using SQL Server Profiler tool to catch SP with Events: RPC:Starting, RPC:Completed. 我的解决方案是使用SQL Server Profiler工具来捕获带有以下事件的SP:RPC:启动,RPC:已完成。 When I call Cancel() method and verify on Profiler, this actually completed with shorter duration than usual. 当我调用Cancel()方法并在Profiler上进行验证时,它实际上比通常的时间短。

Did I kill this process completely (100% for sure)? 我是否完全杀死了这个过程(肯定是100%)?

If I'm wrong, please show me the way to prove. 如果我错了,请告诉我证明的方法。

Thanks in advance !!! 提前致谢 !!!

Create a query which changes data; 创建查询以更改数据; run it asynchrously (ExecuteNonQueryAsync) and immediately cancel it. 异步运行它(ExecuteNonQueryAsync),然后立即将其取消。 Did the data change or not? 数据是否更改?

Although why you're testing the Framework is beyond me... 尽管为什么要测试框架超出了我的范围...

Cheers - 干杯-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM