数据库实时绑定 [英] Database real time binding

查看:83
本文介绍了数据库实时绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚获得了一个项目,对我来说这是目前迄今为止最先进的项目。从来没有做过这样的事情所以我希望得到一些指导。

I just got assigned a project which for me is by far the most advanced yet to date. Never done anything like this before so I would love some guidance.

基本上我有一个WPF应用程序需要监视sql server数据库中的几个表,并且一行一行添加或编辑我需要尽快将此信息提供给应用程序。

Basically I have a WPF-application that needs to monitor a few tables in a sql server database, and as soon as a row gets added or edited I need to get this information asap to the application.

最理想的是实时更新。

我有大约1。5年的编码经验,所以我的noob-brain提出的第一个解决方案是在数据库中有触发器,但是我被教导要总是避免这些。

I've got ~1.5 years of coding experience, so the first solution my noob-brain comes up with is having triggers in the database, but I've been taught to always avoid those.

另一个蹩脚的解决方案是经常运行存储过程,但这将是非常糟糕的做法。

Another lame solution is to run stored procedures frequently, but that would be horribly bad practice.

我如何以最佳方式执行此操作? 

How do I do this in the best possible way? 

*这不是MVVM-app

* This is not a MVVM-app




推荐答案

试着看看
http://msdn.microsoft.com/e n-us / library / system.data.sqlclient.sqldependency.aspx
可以满足您的需求。不确定大局是什么(多少次数,显示多少数据等等...业务需求是什么,有时它有助于提出更好的建议
,包括使用备用的方法,例如
http://msdn.microsoft.com/en-us/library/ee362541.aspx
(其中我没有经历))。

Try to see if http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.aspx could fit your needs. Not sure what is the big picture (how much often, how much data is shown etc... what is the business need, sometimes it helps to raise better suggestion including using alternate approches such as perhaps http://msdn.microsoft.com/en-us/library/ee362541.aspx (which which I have not experience)).


这篇关于数据库实时绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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