The ADO.NET Entity Framework is a popular object-relational mapping framework. It provide abstraction from the underlying relational data that is stored in a database and presents its conceptual schema to the application.
In most of the high transaction cases, the database quickly becomes a bottleneck. Because in database tier, adding more and more servers cannot scale performance.To achieve this scalability use in-memory cache provider module along with Entity Framework application. Although, Entity Framework does not provide a Second Level Cache provider model but it is flexible to support second Level Cache Provider.
Entity Framework Caching Provider
NCache has implemented a custom ADO.NET provider called as "Entity Framework-Caching Provider" which acts between Entity Framework and the original provider. NCache provides the features listed below:
The caching provider can perform various functions, such as:
-
Managing connections, commands, transactions and data read
-
Monitoring queries and commands before they execute.
The following figure shows how and where NCache Entity Framework Provider plugs into an Entity Framework application.
Entity Framework Caching Integration Modes
There are two execution modes for NCache Entity Framework Caching Provider:
-
Analysis Mode
-
Caching Mode
These modes are mutually exclusive, so NCache Entity Framework Caching Provider cannot execute in both modes at the same time. It can either be in "Caching" mode or in "Analysis" mode
Recommendation: First execute the entity framework application within analysis mode of NCache Entity Framework-Caching Provider.
1. Analysis Mode:
Analysis mode is a pass-through mode, no caching is done at this mode. This mode provides features that are listed as follows:
2. Caching Mode:
This mode is basically designed for the actual use of NCache in Entity Framework applications. At this point, queries and their result sets are cached. Caching mode only entertains those queries which are given in configuration file i.e. efcaching.ncconf.
See Also