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
d28d853e
Commit
d28d853e
authored
Apr 18, 2011
by
sam.saffron@gmail.com
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
31a01b28
4898f5e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
.gitignore
.gitignore
+4
-0
PerformanceTests.cs
Tests/PerformanceTests.cs
+17
-3
No files found.
.gitignore
0 → 100644
View file @
d28d853e
/*.suo
bin/
obj/
/*.user
Tests/PerformanceTests.cs
View file @
d28d853e
...
@@ -69,6 +69,8 @@ static DataClassesDataContext GetL2SContext()
...
@@ -69,6 +69,8 @@ static DataClassesDataContext GetL2SContext()
return
new
DataClassesDataContext
(
Program
.
GetOpenConnection
());
return
new
DataClassesDataContext
(
Program
.
GetOpenConnection
());
}
}
private
static
Func
<
EntityFramework
.
tempdbEntities1
,
int
,
EntityFramework
.
Post
>
entityFrameworkCompiled
=
System
.
Data
.
Objects
.
CompiledQuery
.
Compile
<
EntityFramework
.
tempdbEntities1
,
int
,
EntityFramework
.
Post
>((
db
,
id
)
=>
db
.
Posts
.
First
(
p
=>
p
.
Id
==
id
));
public
void
Run
(
int
iterations
)
public
void
Run
(
int
iterations
)
{
{
var
tests
=
new
Tests
();
var
tests
=
new
Tests
();
...
@@ -89,7 +91,20 @@ public void Run(int iterations)
...
@@ -89,7 +91,20 @@ public void Run(int iterations)
var
entityContext2
=
new
EntityFramework
.
tempdbEntities1
();
var
entityContext2
=
new
EntityFramework
.
tempdbEntities1
();
entityContext2
.
Connection
.
Open
();
entityContext2
.
Connection
.
Open
();
tests
.
Add
(
id
=>
entityContext
.
ExecuteStoreQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
ToList
(),
"Entity framework ExecuteStoreQuery"
);
tests
.
Add
(
id
=>
entityContext2
.
ExecuteStoreQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
ToList
(),
"Entity framework ExecuteStoreQuery"
);
var
entityContext3
=
new
EntityFramework
.
tempdbEntities1
();
entityContext3
.
Connection
.
Open
();
tests
.
Add
(
id
=>
entityFrameworkCompiled
(
entityContext3
,
id
),
"Entity framework CompiledQuery"
);
var
entityContext4
=
new
EntityFramework
.
tempdbEntities1
();
entityContext4
.
Connection
.
Open
();
tests
.
Add
(
id
=>
entityContext4
.
Posts
.
Where
(
"it.Id = @id"
,
new
System
.
Data
.
Objects
.
ObjectParameter
(
"id"
,
id
)),
"Entity framework ESQL"
);
var
entityContext5
=
new
EntityFramework
.
tempdbEntities1
();
entityContext5
.
Connection
.
Open
();
entityContext5
.
Posts
.
MergeOption
=
System
.
Data
.
Objects
.
MergeOption
.
NoTracking
;
tests
.
Add
(
id
=>
entityContext
.
Posts
.
First
(
p
=>
p
.
Id
==
id
),
"Entity framework No Tracking"
);
var
mapperConnection
=
Program
.
GetOpenConnection
();
var
mapperConnection
=
Program
.
GetOpenConnection
();
tests
.
Add
(
id
=>
mapperConnection
.
ExecuteMapperQuery
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
}).
ToList
(),
"Mapper Query"
);
tests
.
Add
(
id
=>
mapperConnection
.
ExecuteMapperQuery
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
}).
ToList
(),
"Mapper Query"
);
...
@@ -97,7 +112,6 @@ public void Run(int iterations)
...
@@ -97,7 +112,6 @@ public void Run(int iterations)
var
mapperConnection2
=
Program
.
GetOpenConnection
();
var
mapperConnection2
=
Program
.
GetOpenConnection
();
tests
.
Add
(
id
=>
mapperConnection2
.
ExecuteMapperQuery
(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
}).
ToList
(),
"Dynamic Mapper Query"
);
tests
.
Add
(
id
=>
mapperConnection2
.
ExecuteMapperQuery
(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
}).
ToList
(),
"Dynamic Mapper Query"
);
var
massiveModel
=
new
DynamicModel
(
Program
.
connectionString
);
var
massiveModel
=
new
DynamicModel
(
Program
.
connectionString
);
var
massiveConnection
=
Program
.
GetOpenConnection
();
var
massiveConnection
=
Program
.
GetOpenConnection
();
tests
.
Add
(
id
=>
massiveModel
.
Query
(
"select * from Posts where Id = @0"
,
massiveConnection
,
id
).
ToList
(),
"Dynamic Massive ORM Query"
);
tests
.
Add
(
id
=>
massiveModel
.
Query
(
"select * from Posts where Id = @0"
,
massiveConnection
,
id
).
ToList
(),
"Dynamic Massive ORM Query"
);
...
...
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