Does Entity Framework + System.Data.SQLite provide a Database changed from outside listener / event?

白昼怎懂夜的黑 提交于 2019-12-13 04:00:25

问题


Is there a way to get notified, when the database is newer than the DbContext of EF?

In my case I develop an application that can be installed on several computers. They use the same Database. Since these applications are supposed to run the whole day, chances are high that one is updating data and the other instance of the application is still holding old data in its DbContext.

Now I could implement some checking for new data each minute or so. Or checking for new data each time the user does some I input or comes back to the application. But isn't there an event based solutions available?

if this is important: My Database is SQLite and the ADO.NET provider is System.Data.SQLite (from the SQLite developers)


回答1:


AFAIK SQLite has no "push notifications" mechanism, so this question really has nothing to do with EF. But to answer your question directly: No. If you were using SQLServer there is some stuff you can do with the SqlCacheDependency which is similar to what you're asking, but even that is not supported by the Entity Framework.

It's your responsibility to manage concurrency and update the data as needed.



来源:https://stackoverflow.com/questions/14407195/does-entity-framework-system-data-sqlite-provide-a-database-changed-from-outsi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!