From:一条被猫抛弃的他乡流浪狗!

随笔分类 -  ORM

摘要:1.DbContext怎么在Asp.mvc中使用? 这么定义之后,所有需要用到DbContext对象的地方,都调这个方法。 2. 不要随便using或Dispose DbContext会导致延迟加载的不可用,还会有一些其他错误 如IQueryable<T> 下面的方法(.First() /.Coun 阅读全文
posted @ 2016-12-11 10:16 ICE_Inspire 阅读(6049) 评论(58) 推荐(12) 编辑
摘要:更准确的说法是EF对比SqlHelper ado.net public class SqlHelper { public static readonly string connstr = "Server=.;Database=PhoneBook;Uid=sa;Pwd=********;"; //pa 阅读全文
posted @ 2016-06-25 11:33 ICE_Inspire 阅读(3039) 评论(8) 推荐(5) 编辑
摘要:EF和SqlHelper 简单三层 EF生成sql,再调用ado.net访问数据库,最后使结果对象具体化. 之前的SqlHelper 简单三层的写法,拼接sql语句字符串,再调用ado.net访问数据库,最后也是把结果转换为对象. 明显的区别:sql语句的产生,EF是SQL查询命令和 LINQ 查询 阅读全文
posted @ 2016-06-23 18:36 ICE_Inspire 阅读(2698) 评论(12) 推荐(2) 编辑
摘要:前面提到过这个网址:性能注意事项(实体框架) https://msdn.microsoft.com/zh-cn/library/cc853327.aspx注意版本: .NET Framework (current version) (还有一个其他版本, .NET Framework 4). 此文提到 阅读全文
posted @ 2016-06-21 23:48 ICE_Inspire 阅读(1915) 评论(8) 推荐(9) 编辑
摘要:继续上篇:EntityFramework和EntityFramework.Extended使用说明——性能,语法和产生的sql 1.监控sql 上篇中的sql监控采用的是 Microsoft SQL Server Management Studio中工具->profiler去监控的.当然,Expre 阅读全文
posted @ 2016-06-21 11:44 ICE_Inspire 阅读(1142) 评论(4) 推荐(8) 编辑
摘要:环境说明:EntityFramework 6.1.3和.Net Framework4.5性能注意事项:https://msdn.microsoft.com/zh-cn/library/cc853327.aspx比较精髓的一点:查询执行的各个阶段中的准备查询,每个唯一查询一次。包括编写查询命令、基于模 阅读全文
posted @ 2016-06-20 20:01 ICE_Inspire 阅读(1588) 评论(2) 推荐(6) 编辑
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Simple.Data; namespace SimpleDataStudy { class Program { sta... 阅读全文
posted @ 2016-06-02 17:21 ICE_Inspire 阅读(197) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; using Dapper; namespace DapperTest... 阅读全文
posted @ 2016-06-02 16:56 ICE_Inspire 阅读(441) 评论(1) 推荐(0) 编辑