Second Level Cache for Entity Framework 6.1

Entity Framework does not currently support caching of query results. A sample EF Caching provider is available for Entity Framework version 5 and earlier but due to changes to the provider model this sample provider does not work with Entity Framework 6 and newer. This project is filling the gap by enabling caching of query results for Entity Framework 6.1 applications. https://efcache.codeplex.com/

How to get it

You can get it from NuGet - just install the EntityFramework.Cache NuGet package

How to use it

The project uses a combination of a wrapping provider and a transaction interceptor. A simple InMemoryCache is included in the project. To use it you need first configure EF using code based configuration. Here is an example of how such a configuration looks like.

public class Configuration : DbConfiguration
{
public Configuration()
{
var transactionHandler = new CacheTransactionHandler(new InMemoryCache()); AddInterceptor(transactionHandler); var cachingPolicy = new CachingPolicy(); Loaded +=
(sender, args) => args.ReplaceService<DbProviderServices>(
(s, _) => new CachingProviderServices(s, transactionHandler,
cachingPolicy));
}
}

  

使用前:

安装package:

使用后:

Second Level Cache for Entity Framework 6.1的更多相关文章

  1. [转]Porting to Oracle with Entity Framework NLog

    本文转自:http://izzydev.net/.net/oracle/entityframework/2017/02/01/Porting-to-Oracle-with-Entity-Framewo ...

  2. 第三篇 Entity Framework Plus 之 Query Cache

    离上一篇博客,快一周,工作太忙,只能利用休息日来写一些跟大家分享,Entity Framework Plus 组件系列文章,之前已经写过两篇 第一篇 Entity Framework Plus 之 A ...

  3. Programming Entity Framework 翻译(1)-目录

    1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...

  4. Managing DbContext the right way with Entity Framework 6: an in-depth guide by mehdime

    UPDATE: the source code for DbContextScope is now available on GitHub: DbContextScope on GitHub. A b ...

  5. Entity Framework 6 (7) vs NHibernate 4: DDD perspective(纯净DDD很难很难...)

    There is quite a bit of Entity Framework vs NHibernate comparisons on the web already, but all of th ...

  6. [转]Upgrading to Async with Entity Framework, MVC, OData AsyncEntitySetController, Kendo UI, Glimpse & Generic Unit of Work Repository Framework v2.0

    本文转自:http://www.tuicool.com/articles/BBVr6z Thanks to everyone for allowing us to give back to the . ...

  7. Entity Framework Plus 系列目录

    Entity Framework Plus 系列文章计划的已经全部写完,可能还有其他功能没有写到,希望大家能够多动手,尝试一下使用,一定会给您带来一些帮助的.文章全部写完,也应该出一个目录方便查看,目 ...

  8. 第一篇 Entity Framework Plus 之 Audit

    一般系统会有登陆日志,操作日志,异常日志,已经满足大部分的需求了.但是有时候,还是需要Audit 审计日志,审计日志,主要针对数据增,改,删操作数据变化的记录,主要是对数据变化的一个追踪过程.其中主要 ...

  9. 《Entity Framework 6 Recipes》翻译系列 (1) -----第一章 开始使用实体框架之历史和框架简述

    微软的Entity Framework 受到越来越多人的关注和使用,Entity Framework7.0版本也即将发行.虽然已经开源,可遗憾的是,国内没有关于它的书籍,更不用说好书了,可能是因为EF ...

随机推荐

  1. paip.mysql 全文索引查询空白解决

    paip.mysql 全文索引查询空白解决   或者  Incorrect key file for table: \'%s\'. Try to repair it    作者Attilax  艾龙, ...

  2. PHP--------memcache技术

    新事物的产生都不是偶然的 1.为什么会产生memcache? 在大型的电商web页面上,数据量庞大,大量用户需要同时访问海量的数据,为了提高用户的访问效果,如何才能让页面加载最快,更友好的展示到用户面 ...

  3. bzoj 3517: 翻硬币

    3517: 翻硬币 Time Limit: 1 Sec  Memory Limit: 128 MB Description 有一个n行n列的棋盘,每个格子上都有一个硬币,且n为偶数.每个硬币要么是正面 ...

  4. 比较用decodeFileDescriptor和decodeFile的区别

    从本地中读取图片,可以用decodeFileDescriptor和decodeFile,至于哪一种方式的耗内存情况作了一次简单对比,可能一次选取6张图片数量过少,貌似区别不大,decodeFileDe ...

  5. ios之VFL的补充(二)

    [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[languageI ...

  6. Android平台免Root无侵入AOP框架Dexposed使用详解

    Dexposed是基于久负盛名的开源Xposed框架实现的一个Android平台上功能强大的无侵入式运行时AOP框架. Dexposed的AOP实现是完全非侵入式的,没有使用任何注解处理器,编织器或者 ...

  7. linux web服务器必需的库文件

    往往安装完linux之后,本文用的centos6.4,再编译安装其它服务器软件时,总是提示缺少各种库文件,在这里我总结了一下 平时web服务器经常需要的一些库,如下: yum -y install m ...

  8. git .gitignore 文件 解决二进制文件冲突问题

    .gitignore  主要是添加 忽略文件 .最近团队开发经常出现 UserInterfaceState.xcuserstate 冲突,打开发现是二进制文件 ,没法解决冲突. 只好 rm -rf 之 ...

  9. HQ-SSAO (High-Quality SSAO)

    踩了前前后后无数坑,实现方式都试过了10几种,终于得到这个方案.虽说比不上2015最新的far-field AO,但至少在near/middle-field上,算是state of arts的实现了. ...

  10. php - 执行Linux命令没有报错但也没有输出

    今天我需要在同事访问我的PHP页面的时候执行一段python脚本,于是我的代码是这样写的: 1 <?php 2 function my_workjob(){ 3 $this->makeLo ...