EF code first Acceleration - CodeFirst 加速
EntityFramework Code First 用起来很方便,可是有时感觉卡,就是有点慢。可以采用以下措施来加速一下,原来取出1万条记录并显示在Winform窗体上第一次需要1.9秒的时间,加速后只用0.2秒,基本上快乐10倍!
1. 编译成Release
2. 生成本机代码 Ngen exe,EntityFramework.dll
3. 初始化时不要检查数据库模型的更改情况 Database.SetInitializer<YuContext>(null);
4. 预先生成数据库映射视图
var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext;
var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
mappingCollection.GenerateViews(new List<EdmSchemaError>());
EF code first Acceleration - CodeFirst 加速的更多相关文章
- 【EF Code First】CodeFirst初始配置
1,在Nuget管理中下载EntityFramework 2,配置文件中添加数据库配置 <connectionStrings> <add name="DefaultConn ...
- EF Code First学习系列
EF Model First在实际工作中基本用不到,前段时间学了一下,大概的了解一下.现在开始学习Code First这种方式.这也是在实际工作中用到最多的方式. 下面先给出一些目录: 1.什么是Co ...
- EF Code First 初体验
Code First 顾名思义就是先代码,再由代码生成数据库的开发方式. 废话不多说,直接来一发看看:在VS2010里新建一个空白解决方案,再依次添加两个类库项目:Model.DataAccess和一 ...
- 1.什么是Code First(EF Code First 系列)
EF4.1中开始支持Code First .这种方式在领域设计模式中非常有用.使用Code First模式,你可以专注于领域设计,根据需要,为你一个领域的对象创建类集合,而不是首先来设计数据库,然后来 ...
- EF实体框架之CodeFirst四
在EF实体框架之CodeFirst二中也提到数据库里面一般包括表.列.约束.主外键.级联操作.实体关系(E-R图).存储过程.视图.锁.事务.数据库结构更新等.前面几篇博客把表.存储过程.视图这些算是 ...
- Inheritance with EF Code First: Part 1 – Table per Hierarchy (TPH)
以下三篇文章是Entity Framework Code-First系列中第七回:Entity Framework Code-First(7):Inheritance Strategy 提到的三篇.这 ...
- Some lines about EF Code First migration.
Some lines about EF Code First migration: 一. 模型设计 1. 遵循EF标准,注意表关系配对 2. 数据模型里尽量把必须的属性和说明都写全 3. EF默认id ...
- Sqlite && EF Code FIRST 终极解决方案 2019.5.17
Sqlite && EF Code FIRST 终极解决方案 2019.5.17 包括根据模型自动生成数据库,初始化数据,模型改变时的自动数据迁移等 2019.12.25 更新 支持E ...
- EF Code First Migrations数据库迁移
1.EF Code First创建数据库 新建控制台应用程序Portal,通过程序包管理器控制台添加EntityFramework. 在程序包管理器控制台中执行以下语句,安装EntityFramewo ...
随机推荐
- 初次使用Let's encrypt
wget --no-check-certificate -O shadowsocks.sh https://raw.githubusercontent.com/teddysun/shadowsocks ...
- codevs——1675 大质数 2
1675 大质数 2 时间限制: 1 s 空间限制: 1000 KB 题目等级 : 钻石 Diamond 题解 题目描述 Description 小明因为没做作业而被数学老师罚站,之 ...
- Mcrouter-基于Memcached协议的缓存层流量管理工具(Memcached集群的另一个选择)(转)
Mcrouter 是一个基于Memcached协议的路由器,它是 Facebook缓存架构的核心组件,在峰值的时候,它能够处理每秒50亿次的请求.近日,Facebook开放了Mcrouter的源代码, ...
- Spring Boot中使用Swagger2生成RESTful API文档(转)
效果如下图所示: 添加Swagger2依赖 在pom.xml中加入Swagger2的依赖 <!-- https://mvnrepository.com/artifact/io.springfox ...
- Maticsoft Code Generator
源码:https://github.com/easonjim/MaticsoftCodeGenerator bug提交:https://github.com/easonjim/MaticsoftCod ...
- SQL Server 性能优化实战系列(文章索引) : 桦仔
http://www.cnblogs.com/gaizai/archive/2012/01/20/2327814.html
- LeetCode 9. Palindrome Number (回文数字)
Determine whether an integer is a palindrome. Do this without extra space. 题目标签:Math 题目给了我们一个int x, ...
- Batch 拷贝远程机器文件到本机指定目录下
net use * /del /yesNET USE Y: \\远程机IP\d$ 登录密码 /user:domain\登录用户 set sourcePath="Y:\DOAutomatio ...
- ios6--UILabel
// // ViewController.m // 02-UILabel的使用 // // UILabel显示一段文字. #import "ViewController.h" @i ...
- Versioning with the Override and New Keywords (C# Programming Guide)
The C# language is designed so that versioning between base and derived classes in different librari ...