查询大数据表的效率对比:Linq to SQL、Entity Framework、企业
最近因为要开发大数据量网站,特作比较。
Linq to SQL 查询 记录数:399997
Linq to SQL 查询 Milliseconds:1910
视图查询 记录数:399997
视图查询 Milliseconds:3435
Entity Framework 查询 记录数:400000
Entity Framework 查询 Milliseconds:4049
企业库存储过程 to DataReader 记录数:399997
企业库存储过程 to DataReader Milliseconds:321
企业库存储过程 to DataSet 记录数:399997
企业库存储过程 to DataSet Milliseconds:2807
ADO.Net存储过程 to SqlDataReader 记录数:399997
ADO.Net存储过程 to SqlDataReader Milliseconds:306
企业库SQL语句直接查询 to DataSet 记录数:399997
企业库SQL语句直接查询 to DataSet Milliseconds:3015
企业库SQL语句直接查询 to DataReader 记录数:399997
企业库SQL语句直接查询 to DataReader Milliseconds:367
第二次执行:
代码:
View Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Data;
using System.Diagnostics;
using System.Data.Objects;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SeewoECP.Model.School model = new SeewoECP.Model.School();
model.ID = "1";
model.Name = "test";
model.Country = "test";
model.Province = "test";
model.City = "test";
model.Address = "test";
model.ZipCode = "test";
model.Phone = "test";
model.IsApproved = true;
int repeatTimes = 1;
Stopwatch sw3 = new Stopwatch();
sw3.Start();
for (int i = 0; i < repeatTimes; i++)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>