Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
ee0b246f
Commit
ee0b246f
authored
Jun 02, 2017
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Perf: add EntityFramework Core to legacy tests
parent
3c14c8b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
Benchmarks.EntityFramework.cs
Dapper.Tests.Performance/Benchmarks.EntityFramework.cs
+0
-5
LegacyTests.cs
Dapper.Tests.Performance/LegacyTests.cs
+16
-7
No files found.
Dapper.Tests.Performance/Benchmarks.EntityFramework.cs
View file @
ee0b246f
using
BenchmarkDotNet.Attributes
;
using
BenchmarkDotNet.Attributes
;
using
Dapper.Tests.Performance.Linq2Sql
;
using
System
;
using
System.Data.Linq
;
using
System.Linq
;
using
System.Linq
;
namespace
Dapper.Tests.Performance
namespace
Dapper.Tests.Performance
...
@@ -9,8 +6,6 @@ namespace Dapper.Tests.Performance
...
@@ -9,8 +6,6 @@ namespace Dapper.Tests.Performance
public
class
EF6Benchmarks
:
BenchmarkBase
public
class
EF6Benchmarks
:
BenchmarkBase
{
{
private
EntityFramework
.
EFContext
Context
;
private
EntityFramework
.
EFContext
Context
;
private
static
readonly
Func
<
DataClassesDataContext
,
int
,
Linq2Sql
.
Post
>
compiledQuery
=
CompiledQuery
.
Compile
((
DataClassesDataContext
ctx
,
int
id
)
=>
ctx
.
Posts
.
First
(
p
=>
p
.
Id
==
id
));
[
Setup
]
[
Setup
]
public
void
Setup
()
public
void
Setup
()
...
...
Dapper.Tests.Performance/LegacyTests.cs
View file @
ee0b246f
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
using
Susanoo
;
using
Susanoo
;
using
System.Configuration
;
using
System.Configuration
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Dapper.Tests.Performance.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
namespace
Dapper.Tests.Performance
namespace
Dapper.Tests.Performance
{
{
...
@@ -143,16 +145,23 @@ public async Task RunAsync(int iterations)
...
@@ -143,16 +145,23 @@ public async Task RunAsync(int iterations)
var
entityContext2
=
new
EFContext
(
connection
);
var
entityContext2
=
new
EFContext
(
connection
);
tests
.
Add
(
id
=>
entityContext2
.
Database
.
SqlQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
First
(),
"Entity Framework: SqlQuery"
);
tests
.
Add
(
id
=>
entityContext2
.
Database
.
SqlQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
First
(),
"Entity Framework: SqlQuery"
);
var
entityContext3
=
new
EFContext
(
connection
);
tests
.
Add
(
id
=>
entityContext3
.
Posts
.
AsNoTracking
().
First
(
p
=>
p
.
Id
==
id
),
"Entity Framework: No Tracking"
);
},
"Entity Framework"
);
//var entityContext3 = new EFContext(connection);
// Entity Framework Core
//tests.Add(id => entityFrameworkCompiled(entityContext3, id), "Entity Framework CompiledQuery");
Try
(()
=>
{
var
entityContext
=
new
EFCoreContext
(
ConnectionString
);
tests
.
Add
(
id
=>
entityContext
.
Posts
.
First
(
p
=>
p
.
Id
==
id
),
"Entity Framework Core"
);
//var entityContext4 = new EFContext(connection
);
var
entityContext2
=
new
EFCoreContext
(
ConnectionString
);
//tests.Add(id => entityContext4.Posts.Where("it.Id = @id", new System.Data.Objects.ObjectParameter("id", id)).First(), "Entity Framework ESQL
");
tests
.
Add
(
id
=>
entityContext2
.
Posts
.
FromSql
(
"select * from Posts where Id = {0}"
,
id
).
First
(),
"Entity Framework Core: FromSql
"
);
var
entityContext
5
=
new
EFContext
(
connection
);
var
entityContext
3
=
new
EFContext
(
connection
);
tests
.
Add
(
id
=>
entityContext
5
.
Posts
.
AsNoTracking
().
First
(
p
=>
p
.
Id
==
id
),
"Entity Framework
: No Tracking"
);
tests
.
Add
(
id
=>
entityContext
3
.
Posts
.
AsNoTracking
().
First
(
p
=>
p
.
Id
==
id
),
"Entity Framework Core
: No Tracking"
);
},
"Entity Framework"
);
},
"Entity Framework
Core
"
);
// Dapper
// Dapper
Try
(()
=>
Try
(()
=>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment