查询大数据表的效率对比:Linq to SQL、Entity Framework、企业(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-18 03:26 点击:次
{
DataClasses1DataContext dc = new DataClasses1DataContext();
//IEnumerable<School> schs = dc.ExecuteQuery<School>("Select * from School");
//System.Data.Linq.Table<School> schools = dc.Schools;
List<School> schools = dc.Schools.ToList();
int count = 0;
foreach (School sc in schools)
{
count++;
}
//List<School> schs = schools.ToList();
Response.Write("<br>Linq to SQL 查询 记录数:" + schools.Count().ToString());
}
sw3.Stop();
Response.Write("<br>Linq to SQL 查询 Milliseconds:<font color='#FF0000'>" + sw3.ElapsedMilliseconds+"</font>");
Stopwatch sw2 = new Stopwatch();
sw2.Start();
DataSet dr = new DataSet();
for (int i = 0; i < repeatTimes; i++)
{
dr = selectView();
}
Response.Write("<br>视图查询 记录数:" + dr.Tables[0].Rows.Count);
sw2.Stop();
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>