简体   繁体   English

实体框架:检测并加载表更改

[英]Entity Framework: detect and load table changes

There is MSSQL Express Server and several apps are using it. 有MSSQL Express Server,并且有几个应用程序正在使用它。

App1 adds or updates rows in table1. App1添加或更新table1中的行。

Table1 must be loaded in App2. 表1必须加载到App2中。 And app2 should use valid data any time. 而且app2应该随时使用有效数据。 How I can reload table1 data if changes are occured? 如果发生更改,如何重新加载table1数据?

using Entity Framework 6. 使用实体框架6。

image 图片

App2 needs to "check" the table1 for new data and reload it. App2需要“检查”表1中的新数据并重新加载它。 You can perform a select on table 1 and look for new rows by ID for example. 您可以在表1上执行选择,然后按ID查找新行。

It simple as it looks . 它看起来很简单。

Case 1 : when there is a change in data in table . 情况1:当表中的数据发生变化时。 upon you access to the content ON-LOAD or Post you will get updated data automatically . 在您访问内容ON-LOAD或Post后,您将自动获得更新的数据。

Case 2 : When there are changes in columns or table schema etc . 情况2:当列或表模式等发生变化时。 you just open edmx after than on the panel where all tables dispalyed Right click and Click Update option and then build which will auto generate entities automatically . 您只需在所有表都消失的面板上打开edmx,然后单击鼠标右键,然后单击“更新”选项,然后进行构建即可自动自动生成实体。

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM