Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Microsoft recommend for 2nd level Caching in Entity Framework?

I've used "EF Provider Wrappers" made by Jarek Kowalski. It works fine but I noticed "Limitations and Disclaimers" section where it says:

The providers have not been extensively tested beyond what’s included in the sample code, so you should use them at your own risk.

As with any other sample, Microsoft is not offering any kind of support for it, but if you find bugs or have feature suggestions, please use this blog’s contact form and let me know about them.

I'm little confused here, Does Microsoft really expect developers to use EnityFramework on production websites without any official support (or recommendation) for 2nd level Caching?

like image 738
Raj Avatar asked Aug 17 '12 05:08

Raj


People also ask

Which caching is supported by the Entity Framework?

Data Points - Second-Level Caching in the Entity Framework and AppFabric.

What is second-level data cache?

A second-level cache is a local store of entity data managed by the persistence provider to improve application performance. A second-level cache helps improve performance by avoiding expensive database calls, keeping the entity data local to the application.

What is caching in Entity Framework?

The Entity Framework (EF) ObjectContext and DbContext maintain state information about entities they're managing. But once the context goes out of scope, that state information is gone. This type of caching is referred to as first-level caching and is only available for the lifetime of a transaction.

How do I cache Entity Framework?

EF+ Query Cache opens up all caching features for Entity Framework Core users. To use caching, simply append to the query "FromCache" method before using an immediate resolution method like "ToList()" or "FirstOrDefault()".


1 Answers

There is no official 2nd level cache support. I'm even not sure if EF Provider wrappers are compatible with .NET 4.5. 2nd level cache is in backlog for future versions of EF.

You can also implement your own solution because EF is fully open sourced.

Btw. I have seen dozens of quite complex web sites running in production without any cache ...

like image 125
Ladislav Mrnka Avatar answered Oct 15 '22 15:10

Ladislav Mrnka