如何刷新 WPF 上的 NHibernate 缓存数据?
我有一个使用 NHibernate 和延迟数据加载的 WPF 应用程序。我还使用 Microsoft Sync 框架与中央数据库服务器同步数据。因此,当我修改中央数据库服务器上的数据并将其与 WPF 客户端应用程序同步时,我无法将最新数据显示到 UI,因为 NHibernate 已经缓存了它。所以我需要重新启动WPF应用程序才能显示最新的同步数据。
我需要一个解决方案来刷新 WPF 应用程序上的 NHibernate 数据。我该怎么做?
I have this WPF application using NHibernate and lazy data loading. I also use Microsoft Sync framework to sync data to and from a central database server. So what happens is that when I modify data on the central database server and sync it with the WPF client app, I can't get the latest data to be displayed to the UI since NHibernate has cached it already. So I need to restart the WPF application to be able to display the latest synched data.
I need a solution to refresh NHibernate data on the WPF app. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一级缓存仅在给定会话中处于活动状态,因此,如果您每次尝试检索对象时都使用新会话,您应该会获得最新结果(假设您没有配置二级缓存)。
The first level cache is only active within a given session, so if you use a new session each time you attempt to retrieve the object you should get the latest results (given you don't have the second level cache configured).