我正在通过MVC 3应用程序中的ADO.NET实体框架访问我的数据库。使用实体框架时数据库中未反映的更改
我正在通过存储过程更新我的数据库。
但变化不会在运行再寄一次体现的意思是说,我能够重新启动仅之后看到的变化。
什么是问题的原因以及如何避免呢? 我使用Repository模式因此,在库我的代码看起来象
疗法是一种功能,保存更改
公共无效SaveNewAnswer(AnswerViewModel答案,字符串用户) {
SurveyAdminDBEntities _entities = new SurveyAdminDBEntities();
_entities.usp_SaveNewAnswer(answer.QuestionId, answer.AnswerName, answer.AnswerText, answer.AnswerOrder, answer.Status, user);
_entities.SaveChanges();
}
数据Retreival代码
公共IEnumerableGetMultipleChoiceQuesti附件(字符串questionId) {
SurveyAdminDBEntities _entities = new SurveyAdminDBEntities();
_entities.AcceptAllChanges();
_entities.SaveChanges();
return _entities.usp_GetMultipleChoiceQuestions(Int32.Parse(questionId));
}
但更改不会反映,直到我不clode浏览器会话并再次运行的时间。
请帮忙!
预先感谢您
查看具体有哪些变化? –
您可以向我们展示**您用于操作的一些代码**吗?也许你错过了一些.....(但我们无法介意 - 读你的屏幕....) –
添加我的问题! –