查询大数据表的效率对比:Linq to SQL、Entity Framework、企业(3)
Response.Write("<br>视图查询 Milliseconds:<font color='#FF0000'>" + sw2.ElapsedMilliseconds + "</font>");
Stopwatch sw4 = new Stopwatch();
sw4.Start();
for (int i = 0; i < repeatTimes; i++)
{
ECPDBEntities1 ecp = new ECPDBEntities1();
ObjectSet<ClassGroup> classGroup = ecp.ClassGroup;
//List<ClassGroup> classGroup = ecp.ClassGroup.ToList();
//List<ClassGroup> classGroup =
//from s in ecp.ClassGroup where s.id < 10 select s.name;
//ClassGroup cg = classGroup.Single(s => s.ID == "1");
int count = 0;
foreach (ClassGroup c in classGroup)
{
count++;
//Response.Write( c.ClassName);
}
Response.Write("<br>Entity Framework 查询 记录数:" + classGroup.Count());
}
sw4.Stop();
Response.Write("<br>Entity Framework 查询 Milliseconds:<font color='#FF0000'>" + sw4.ElapsedMilliseconds + "</font>");
Stopwatch sw = new Stopwatch();
sw.Start();
for (int i = 0; i < repeatTimes; i++)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>