开发者

How to stop entity framework caching

We're havi开发者_运维知识库ng 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.

How to stop entity framework caching

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

context.ContextOptions.LazyLoadingEnabled = false;


In EF4 I had to use this instead:

_context.Configuration.LazyLoadingEnabled = false;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜