C#/ SQL数据库监听器需要帮助 [英] C#/SQL Database listener help needed

查看:138
本文介绍了C#/ SQL数据库监听器需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,不断监测数据库行来检查变更(更新)。如果有来自其他来源的一些变化或更新事件应该在我的应用程序被开除(我使用的是WCF)。有没有什么办法,不断倾听数据库行的变化?

I have a requirement to monitor the Database rows continuously to check for the Changes(updates). If there are some changes or updates from the other sources the Event should be fired on my application (I am using a WCF). Is there any way to listen the database row continuously for the changes?

我可以具有更多的事件的数目来监测在同一个表的不同行。是有在性能情况下,任何问题。我使用C#Web服务来监视SQL服务器后端。

I may be having more number of events to monitor different rows in the same table. is there any problem in case of performance. I am using C# web service to monitor the SQL Server back end.

推荐答案

我有一个非常类似的规定,前一段时间,我使用CLR SP将数据推入一个消息队列解决了这个问题。

I had a very similar requirement some time ago, and I solved it using a CLR SP to push the data into a message queue.

要简化部署,我创建了一个名为一个小小的功能的CLR SP SendMessage函数刚推的消息到消息队列,并用它绑在我的表一个AFTER INSERT触发器(正常触发,没有CLR触发)。

To ease deployment, I created an CLR SP with a tiny little function called SendMessage that was just pushing a message into a Message Queue, and tied it to my tables using an AFTER INSERT trigger (normal trigger, not CLR trigger).

性能是我在这种情况下主要关注的问题,但我有压力测试,它大大超过了我的预期。而相比于SQL Server服务代理,这是一个非常易于部署的解决方案。在CLR SP的code是真是小巫见大巫为好。

Performance was my main concern in this case, but I have stress tested it and it greatly exceeded my expectations. And compared to SQL Server Service Broker, it's a very easy-to-deploy solution. The code in the CLR SP is really trivial as well.

这篇关于C#/ SQL数据库监听器需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆