Second Level Cache
Entity Framework currently support only first level cache (cache for entities). I would like to see a second level cahce implemented in the next version (queries cache).
Gazsi Robert commented
Any feedback after such a long review (over 3 years now)?
Anybody knows of an open source initiative on this?
Absolutely agree with Martin. This feature was suggested long-long time ago. All modern ORM has it supported.
Please stop reviewing and just get this done. There are so many problems with the providers offered by http://code.msdn.microsoft.com/EFProviderWrappers-c0b88f32 when using CodeFirst, particularly if you are doing a multi-tenant application with a DB per tenant scheme as I am doing, using migrations.
And yes, for Azure Database, performance is a serious concern where caching is critical. Having to ad-hoc cache at all the various points where we want to cache is too painful. At least some out of the box extension points for caching should be a no-brainer.
Simon de Kraa commented
Especially on Windows Azure where at the moment you have quite a performance penalty using SQL Azure and with the availability of Windows Azure cache to me this seems like a must have on Windows Azure.
Also a sample with dbcontext http://www.codeproject.com/Articles/435142/Entity-Framework-Second-Level-Caching-with-DbConte
Vahid Nasiri commented
Here you can find an implementation of second level caching in EF Code first:
This is already something that can be acheived http://msdn.microsoft.com/en-us/magazine/hh394143.aspx but it should be something simple to accomplish.
@Tommy compare EFCachingProvider to NHibernate's built in configurable option. 2nd level cache is a must for ORM and should be readily available to the user.
Unless I don't understand this issue correctly, this would be achieved by simply expanding upon Jaroslaw Kowalski's example of implementing first level caching:
His example already provides access to the underlying connections and commands, which you should have no problem using to extend as described?
Byung Choi commented
EF should be easily extensible. One of the main concern is caching.
Hibernate and NHibernate went through this issue years ago.
Felipe Fujiy Pessoto commented
Cache isn´t responsability of domain.
Cache is a cross-cutting concern.
ASP really need cashing support.
if that means the ability to query the datacontext offline without db connection using LINQ , then that would be really cool and much much needed
Denis Kotov commented
Caching is needed for ASP.NET applications. Possibility addition dependence on changes in a source by SqlCacheDependency.
Unai Zorrilla commented
Nooooooooooooooo, cache is responsability of domain, cache is bussines no data .......