如何获取BindingSource以获取实体框架中的最新数据. [英] How to get the BindingSource to get the most current data in Entity framwork.

查看:117
本文介绍了如何获取BindingSource以获取实体框架中的最新数据.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取BindingSource以获取实体框架中的最新数据.

How to get the BindingSource to get the most current data in Entity framwork.

推荐答案

您唯一可以自动完成此操作的方法是创建一个触发器然后调用您放在一起的一些代码,这些代码又告诉您的应用程序已插入/更新/删除了一行. 但是太混乱了,扩展性也不太好.

当我拥有一个经常从不同来源使用和更新的列表时,我个人喜欢的是放置一个刷新按钮,以便用户可以强制刷新数据.而且,当用户导航到具有该列表的视图时,我会对其进行一些限制,从而更新该列表,因此该列表不会在10秒内刷新5次,因为用户工作速度很快.

因此,根据您的情况,我建议您在用户单击刷新"或导航到您的视图时查询数据库.
The only way you can get that done automaticly is by creating a trigger which then calls some code you put together, which in turn tells your applications that a row were inserted/updated/deleted. But that''s extremely messy and doesn''t scale well.

What I personally like to dom in cases when I have a list that is often used and updated from different sources, is to place a refresh button so the user can force a refresh of the data. And I update the list when the user navigates to the view with the list, with some throttling, so the list is not refreshed 5 times in 10 seconds because the user works fast.

So in your case I suggest you query the database when the user clicks refresh or navigate to your view.


这篇关于如何获取BindingSource以获取实体框架中的最新数据.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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