ADO.net实体模型没有刷新数据

时间:2021-04-12 02:09:37

I have an ADO.net entity model from a mysql database, the database stores images locations or urls in a table called multimedia, there is a page that displays this images in a gallery. Whenever I save a new image from the website or directly into the database it won't show up in the gallery until I change something in the code (anything, this seems to refresh the model), or go to the model and right click and update it.

我有一个来自mysql数据库的ADO.net实体模型,数据库将图像位置或URL存储在名为multimedia的表中,有一个页面在库中显示这些图像。每当我从网站上保存新图像或直接进入数据库时​​,它都不会显示在图库中,直到我更改代码中的内容(任何东西,这似乎刷新了模型),或者转到模型并右键单击更新它。

I tried model.Refresh(System.Data.Objects.RefreshMode.ClientWins, model.multimedia) and model.Refresh(System.Data.Objects.RefreshMode.StoreWins, model.multimedia), from the controller nothing happens.

我尝试了model.Refresh(System.Data.Objects.RefreshMode.ClientWins,model.multimedia)和model.Refresh(System.Data.Objects.RefreshMode.StoreWins,model.multimedia),从控制器没有任何反应。

If I refresh the model from visual studio the images do show up. So the question is how can I refresh the data without having to update the model from Visual Studio?

如果我从visual studio刷新模型,图像会显示出来。所以问题是如何在不必从Visual Studio更新模型的情况下刷新数据?

1 个解决方案

#1


1  

Problem solved, data context was static

问题解决了,数据上下文是静态的

#1


1  

Problem solved, data context was static

问题解决了,数据上下文是静态的