如何停止实体框架缓存 [英] How to stop entity framework caching

查看:126
本文介绍了如何停止实体框架缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在测试Entity Framework 4时遇到问题。



我们部署了实现EF数据上下文的WCF服务。所有工作都很好,直到我们使用SQL Server studio修改数据。



有没有办法阻止EF缓存我们的结果,还是有任何方法来转换热心的加载? / p>

干杯,



James

解决方案

在您的型号属性表中,您可以设置 Lazy Loading Enabled 属性。





通过代码,你可以使用 ObjectContextOptions.LazyLoadingEnabled 属性:

  context.ContextOptions.LazyLoadingEnabled = false; 


We're having a problem testing Entity Framework 4.

We've deployed a WCF service that implements an EF data context. All works fine untill we modify the data using SQL server studio.

Is there a way to stop EF caching our results or is there any way to turn eager loading on?

Cheers,

James

解决方案

On the property sheet for your model, you can set the Lazy Loading Enabled property.

Through code, you can control lazy loading with the ObjectContextOptions.LazyLoadingEnabled property:

context.ContextOptions.LazyLoadingEnabled = false;

这篇关于如何停止实体框架缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆