Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#.NET SqlDependency_C#_.net_Sql Server_Sqldependency - Fatal编程技术网

C#.NET SqlDependency

C#.NET SqlDependency,c#,.net,sql-server,sqldependency,C#,.net,Sql Server,Sqldependency,我有一个关于.NET中SqlDependency的用法的问题。我已经阅读了文档,但仍然不清楚OnChange事件是否在自己的线程中被调用。例如,如果我得到30个并发事件,它们是否都有自己的OnChange-even处理程序?我问这个问题的原因是,如果OnChange处理程序中正在执行的工作阻塞了下一个事件,我不想用它创建引擎 例如,我有一个Orders数据库的SqlDependency,每次有新订单时,我都会收到OnChange事件,然后我就可以处理用户的订单。这不会妨碍其他人进来,对吗 另外,

我有一个关于.NET中SqlDependency的用法的问题。我已经阅读了文档,但仍然不清楚OnChange事件是否在自己的线程中被调用。例如,如果我得到30个并发事件,它们是否都有自己的OnChange-even处理程序?我问这个问题的原因是,如果OnChange处理程序中正在执行的工作阻塞了下一个事件,我不想用它创建引擎

例如,我有一个Orders数据库的SqlDependency,每次有新订单时,我都会收到OnChange事件,然后我就可以处理用户的订单。这不会妨碍其他人进来,对吗

另外,您是否发现使用此方法有任何问题?SqlDependency似乎是一个非常强大的功能,所以我希望它能以这种方式工作

谢谢

根据上面链接中有关SqlDependency类的msdn信息中的注释,quote->

"The OnChange event may be generated on a different thread from
 the thread that initiated command execution. "
"SqlDependency was designed to be used in ASP.NET or middle-tier 
 services where there is a relatively small number of servers 
 having dependencies active against the database. It was not 
 designed for use in client applications, where hundreds or
 thousands of client computers would have SqlDependency
 objects set up for a single database server. "
另一方面,在同一页上有以下注释,quote->

"The OnChange event may be generated on a different thread from
 the thread that initiated command execution. "
"SqlDependency was designed to be used in ASP.NET or middle-tier 
 services where there is a relatively small number of servers 
 having dependencies active against the database. It was not 
 designed for use in client applications, where hundreds or
 thousands of client computers would have SqlDependency
 objects set up for a single database server. "

根据上面链接中有关SqlDependency类的msdn信息中的注释,quote->

"The OnChange event may be generated on a different thread from
 the thread that initiated command execution. "
"SqlDependency was designed to be used in ASP.NET or middle-tier 
 services where there is a relatively small number of servers 
 having dependencies active against the database. It was not 
 designed for use in client applications, where hundreds or
 thousands of client computers would have SqlDependency
 objects set up for a single database server. "
另一方面,在同一页上有以下注释,quote->

"The OnChange event may be generated on a different thread from
 the thread that initiated command execution. "
"SqlDependency was designed to be used in ASP.NET or middle-tier 
 services where there is a relatively small number of servers 
 having dependencies active against the database. It was not 
 designed for use in client applications, where hundreds or
 thousands of client computers would have SqlDependency
 objects set up for a single database server. "

同样,信息非常模糊。“可能在不同的线程上生成”并不能完全回答我的问题。至于第二部分,正如您从我问题中的示例中看到的,这是在中间层(接受客户订单)。那么,这是否会阻止其他事件,或者它会在自己的线程中处理所有并发事件?另外,其他中等规模的网站如何处理此类事务,您需要对更新采取行动,然后将数据处理到另一个数据库,有可能出错并需要再次处理的地方?我目前在数据库计算机上运行一个windows服务,该服务对Orders数据库具有sqldependency,对于每次插入,我都会处理数据并将其发送到另一台服务器的数据库。如果调度失败,我会在windows服务中设置一个计时器,每隔一分钟处理一次未处理的订单。我必须假设这是一种非常常见的情况。其他web应用程序如何做到这一点?这是我能想到的唯一可行的方法,所以我想知道是否会阻止任何或所有并发订单的处理。同样,非常模糊的信息。“可能在不同的线程上生成”并不能完全回答我的问题。至于第二部分,正如您从我问题中的示例中看到的,这是在中间层(接受客户订单)。那么,这是否会阻止其他事件,或者它会在自己的线程中处理所有并发事件?另外,其他中等规模的网站如何处理此类事务,您需要对更新采取行动,然后将数据处理到另一个数据库,有可能出错并需要再次处理的地方?我目前在数据库计算机上运行一个windows服务,该服务对Orders数据库具有sqldependency,对于每次插入,我都会处理数据并将其发送到另一台服务器的数据库。如果调度失败,我会在windows服务中设置一个计时器,每隔一分钟处理一次未处理的订单。我必须假设这是一种非常常见的情况。其他web应用程序如何做到这一点?这是我唯一能想到的让它工作的方法,所以我想知道是否会阻止任何或所有并发订单的处理。