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

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

问题描述

我们遇到了一个问题,测试实体框架4。

We're having a problem testing Entity Framework 4.

我们已经部署了一个实现EF数据上下文的WCF服务。一切工作正常,直到我们使用SQL Server的工作室修改数据。

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

有没有办法阻止EF缓存我们的结果还是没有任何办法把预先加载了?

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

干杯,

詹姆斯

推荐答案

在属性表为您的模型,您可以设置延迟加载启用属性。

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

通过code,可以控制延迟加载的<一个href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontextoptions.lazyloadingenabled.aspx"><$c$c>ObjectContextOptions.LazyLoadingEnabled属性:

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

context.ContextOptions.LazyLoadingEnabled = false;

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

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