实体框架和缓存 [英] entity framework and caching

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

问题描述

嗨!实体框架是否默认缓存数据或者如何工作。例如,如果我有一个gridview,其数据源是我从存储库中提取的对象的集合,那么当我在gridview中通过
分页时,代码是否会触及数据库?因为我正在调用同样的方法,即在gridview的页面索引更改事件上提取数据。感谢您的帮助。

Hi! Does the entity framework cache the data by default or how's that work. For example if i have a gridview whose datasource is a collection of objects that i am pulling from a repository then does the code hit the database againg when I am paging thru the record in gridview? Because I am calling againg that same method that's pulling data on page index changing event of gridview.. Thanks for any help.

推荐答案

对实体框架的查询ObjectContext始终转到数据库。你当然可以在EF之上分层缓存,但它不是内置的。

Queries against the entity framework's ObjectContext always go to the database. You can certainly layer caching on top of the EF, but it is not built in.


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

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