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
1e0f34bc
Commit
1e0f34bc
authored
Apr 14, 2011
by
Nick Berardi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added 3 new EF tests
parent
034a4efc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
PerformanceTests.cs
Tests/PerformanceTests.cs
+17
-3
No files found.
Tests/PerformanceTests.cs
View file @
1e0f34bc
...
...
@@ -69,6 +69,8 @@ static DataClassesDataContext GetL2SContext()
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
)
{
var
tests
=
new
Tests
();
...
...
@@ -89,7 +91,20 @@ public void Run(int iterations)
var
entityContext2
=
new
EntityFramework
.
tempdbEntities1
();
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
();
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)
var
mapperConnection2
=
Program
.
GetOpenConnection
();
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
massiveConnection
=
Program
.
GetOpenConnection
();
tests
.
Add
(
id
=>
massiveModel
.
Query
(
"select * from Posts where Id = @0"
,
massiveConnection
,
id
).
ToList
(),
"Dynamic Massive ORM Query"
);
...
...
@@ -213,4 +227,4 @@ public static string GetNullableString(this SqlDataReader reader, int index)
return
null
;
}
}
}
}
\ No newline at end of file
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