sunkaixuan
8 years ago
9 changed files with 120 additions and 9 deletions
@ -1,6 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<configuration> |
|||
<startup> |
|||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> |
|||
</startup> |
|||
</configuration> |
@ -1,6 +1,6 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<ProjectView>ShowAllFiles</ProjectView> |
|||
<ProjectView>ProjectFiles</ProjectView> |
|||
</PropertyGroup> |
|||
</Project> |
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Chloe; |
|||
using Chloe.SqlServer; |
|||
using OrmTest.Models; |
|||
|
|||
namespace OrmTest.PerformanceTesting |
|||
{ |
|||
public class ChloeORMPerformance: PerformanceBase |
|||
{ |
|||
public void Select() |
|||
{ |
|||
MsSqlContext db = new MsSqlContext(Config.ConnectionString); |
|||
db.Query<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList(); |
|||
base.Execute("chloe", () => |
|||
{ |
|||
var test = db.Query<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList(); |
|||
}); |
|||
db.Dispose(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
using SyntacticSugar; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace OrmTest.PerformanceTesting |
|||
{ |
|||
public class PerformanceBase |
|||
{ |
|||
public int count = 100; |
|||
public void Execute(string title, Action fun) |
|||
{ |
|||
PerformanceTest ptef = new PerformanceTest(); |
|||
ptef.SetCount(count);//执行count次
|
|||
ptef.Execute( |
|||
i => |
|||
{ |
|||
fun(); |
|||
|
|||
}, |
|||
res => |
|||
{ |
|||
Console.WriteLine(string.Format("Execute {0} time,{1}{2}", count, title, res)); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using SqlSugar; |
|||
using OrmTest.Models; |
|||
|
|||
namespace OrmTest.PerformanceTesting |
|||
{ |
|||
public class SqlSugarPerformance : PerformanceBase |
|||
{ |
|||
public void Select() |
|||
{ |
|||
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() |
|||
{ |
|||
ConnectionString = Config.ConnectionString, |
|||
DbType = DbType.SqlServer, |
|||
IsAutoCloseConnection = false |
|||
}); |
|||
db.IgnoreComumns.Add("TestId", "Student"); |
|||
db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList(); |
|||
base.Execute("sqlsuagr", () => |
|||
{ |
|||
var test = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList(); |
|||
}); |
|||
db.Close(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="Chloe.SqlServer" version="2.6.0" targetFramework="net452" /> |
|||
<package id="SyntacticSugar" version="2.4.1" targetFramework="net452" /> |
|||
</packages> |
Loading…
Reference in new issue