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
c3b7b399
Commit
c3b7b399
authored
Apr 04, 2011
by
Sam Saffron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor correction to test
parent
d8125809
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
10 deletions
+34
-10
PerformanceTests.cs
PerformanceTests.cs
+34
-10
No files found.
PerformanceTests.cs
View file @
c3b7b399
...
@@ -108,18 +108,19 @@ public void Run(int iterations)
...
@@ -108,18 +108,19 @@ public void Run(int iterations)
reader
.
Read
();
reader
.
Read
();
var
post
=
new
Post
();
var
post
=
new
Post
();
post
.
Id
=
reader
.
GetInt32
(
0
);
post
.
Id
=
reader
.
GetInt32
(
0
);
post
.
Text
=
reader
.
GetString
(
1
);
post
.
Text
=
reader
.
Get
Nullable
String
(
1
);
post
.
CreationDate
=
reader
.
GetDateTime
(
2
);
post
.
CreationDate
=
reader
.
GetDateTime
(
2
);
post
.
LastChangeDate
=
reader
.
GetDateTime
(
3
);
post
.
LastChangeDate
=
reader
.
GetDateTime
(
3
);
post
.
Counter1
=
reader
.
IsDBNull
(
4
)
?
(
int
?)
null
:
reader
.
GetInt32
(
4
);
post
.
Counter2
=
reader
.
IsDBNull
(
5
)
?
(
int
?)
null
:
reader
.
GetInt32
(
5
);
post
.
Counter1
=
reader
.
GetNullableValue
<
int
>(
4
);
post
.
Counter3
=
reader
.
IsDBNull
(
6
)
?
(
int
?)
null
:
reader
.
GetInt32
(
6
);
post
.
Counter2
=
reader
.
GetNullableValue
<
int
>(
5
);
post
.
Counter4
=
reader
.
IsDBNull
(
7
)
?
(
int
?)
null
:
reader
.
GetInt32
(
7
);
post
.
Counter3
=
reader
.
GetNullableValue
<
int
>(
6
);
post
.
Counter5
=
reader
.
IsDBNull
(
8
)
?
(
int
?)
null
:
reader
.
GetInt32
(
8
);
post
.
Counter4
=
reader
.
GetNullableValue
<
int
>(
7
);
post
.
Counter6
=
reader
.
IsDBNull
(
9
)
?
(
int
?)
null
:
reader
.
GetInt32
(
9
);
post
.
Counter5
=
reader
.
GetNullableValue
<
int
>(
8
);
post
.
Counter7
=
reader
.
IsDBNull
(
10
)
?
(
int
?)
null
:
reader
.
GetInt32
(
10
);
post
.
Counter6
=
reader
.
GetNullableValue
<
int
>(
9
);
post
.
Counter8
=
reader
.
IsDBNull
(
11
)
?
(
int
?)
null
:
reader
.
GetInt32
(
11
);
post
.
Counter7
=
reader
.
GetNullableValue
<
int
>(
10
);
post
.
Counter9
=
reader
.
IsDBNull
(
12
)
?
(
int
?)
null
:
reader
.
GetInt32
(
12
);
post
.
Counter8
=
reader
.
GetNullableValue
<
int
>(
11
);
post
.
Counter9
=
reader
.
GetNullableValue
<
int
>(
12
);
}
}
},
"hand coded"
);
},
"hand coded"
);
...
@@ -128,4 +129,27 @@ public void Run(int iterations)
...
@@ -128,4 +129,27 @@ public void Run(int iterations)
}
}
}
}
static
class
SqlDataReaderHelper
{
public
static
string
GetNullableString
(
this
SqlDataReader
reader
,
int
index
)
{
object
tmp
=
reader
.
GetValue
(
index
);
if
(
tmp
!=
DBNull
.
Value
)
{
return
(
string
)
tmp
;
}
return
null
;
}
public
static
Nullable
<
T
>
GetNullableValue
<
T
>(
this
SqlDataReader
reader
,
int
index
)
where
T
:
struct
{
object
tmp
=
reader
.
GetValue
(
index
);
if
(
tmp
!=
DBNull
.
Value
)
{
return
(
T
)
tmp
;
}
return
null
;
}
}
}
}
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