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
bcab7d7b
Commit
bcab7d7b
authored
May 11, 2011
by
simon.cropp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some unused code
parent
09f8759b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
SqlMapper.cs
Dapper/SqlMapper.cs
+11
-12
No files found.
Dapper/SqlMapper.cs
View file @
bcab7d7b
...
@@ -197,7 +197,7 @@ private static IEnumerable<T> QueryInternal<T>(this IDbConnection cnn, string sq
...
@@ -197,7 +197,7 @@ private static IEnumerable<T> QueryInternal<T>(this IDbConnection cnn, string sq
{
{
if
(
info
.
Deserializer
==
null
)
if
(
info
.
Deserializer
==
null
)
{
{
info
.
Deserializer
=
GetDeserializer
<
T
>(
identity
,
reader
);
info
.
Deserializer
=
GetDeserializer
<
T
>(
reader
);
queryCache
[
identity
]
=
info
;
queryCache
[
identity
]
=
info
;
}
}
...
@@ -284,30 +284,30 @@ class DontMap {}
...
@@ -284,30 +284,30 @@ class DontMap {}
var
otherDeserializer
=
new
List
<
object
>();
var
otherDeserializer
=
new
List
<
object
>();
split
=
nextSplit
();
split
=
nextSplit
();
info
.
Deserializer
=
GetDeserializer
<
TFirst
>(
identity
,
reader
,
0
,
split
);
info
.
Deserializer
=
GetDeserializer
<
TFirst
>(
reader
,
0
,
split
);
if
(
typeof
(
TSecond
)
!=
typeof
(
DontMap
))
if
(
typeof
(
TSecond
)
!=
typeof
(
DontMap
))
{
{
var
next
=
nextSplit
();
var
next
=
nextSplit
();
otherDeserializer
.
Add
(
GetDeserializer
<
TSecond
>(
identity
,
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
otherDeserializer
.
Add
(
GetDeserializer
<
TSecond
>(
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
split
=
next
;
split
=
next
;
}
}
if
(
typeof
(
TThird
)
!=
typeof
(
DontMap
))
if
(
typeof
(
TThird
)
!=
typeof
(
DontMap
))
{
{
var
next
=
nextSplit
();
var
next
=
nextSplit
();
otherDeserializer
.
Add
(
GetDeserializer
<
TThird
>(
identity
,
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
otherDeserializer
.
Add
(
GetDeserializer
<
TThird
>(
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
split
=
next
;
split
=
next
;
}
}
if
(
typeof
(
TFourth
)
!=
typeof
(
DontMap
))
if
(
typeof
(
TFourth
)
!=
typeof
(
DontMap
))
{
{
var
next
=
nextSplit
();
var
next
=
nextSplit
();
otherDeserializer
.
Add
(
GetDeserializer
<
TFourth
>(
identity
,
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
otherDeserializer
.
Add
(
GetDeserializer
<
TFourth
>(
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
split
=
next
;
split
=
next
;
}
}
if
(
typeof
(
TFifth
)
!=
typeof
(
DontMap
))
if
(
typeof
(
TFifth
)
!=
typeof
(
DontMap
))
{
{
var
next
=
nextSplit
();
var
next
=
nextSplit
();
otherDeserializer
.
Add
(
GetDeserializer
<
TFifth
>(
identity
,
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
otherDeserializer
.
Add
(
GetDeserializer
<
TFifth
>(
reader
,
split
,
next
-
split
,
returnNullIfFirstMissing
:
true
));
}
}
info
.
OtherDeserializers
=
otherDeserializer
.
ToArray
();
info
.
OtherDeserializers
=
otherDeserializer
.
ToArray
();
...
@@ -373,7 +373,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
...
@@ -373,7 +373,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
return
info
;
return
info
;
}
}
private
static
Func
<
IDataReader
,
T
>
GetDeserializer
<
T
>(
I
dentity
identity
,
I
DataReader
reader
,
int
startBound
=
0
,
int
length
=
-
1
,
bool
returnNullIfFirstMissing
=
false
)
private
static
Func
<
IDataReader
,
T
>
GetDeserializer
<
T
>(
IDataReader
reader
,
int
startBound
=
0
,
int
length
=
-
1
,
bool
returnNullIfFirstMissing
=
false
)
{
{
// dynamic is passed in as Object ... by c# design
// dynamic is passed in as Object ... by c# design
if
(
typeof
(
T
)
==
typeof
(
object
)
||
typeof
(
T
)
==
typeof
(
FastExpando
))
if
(
typeof
(
T
)
==
typeof
(
object
)
||
typeof
(
T
)
==
typeof
(
FastExpando
))
...
@@ -384,7 +384,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
...
@@ -384,7 +384,7 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
{
{
return
GetClassDeserializer
<
T
>(
reader
,
startBound
,
length
,
returnNullIfFirstMissing
);
return
GetClassDeserializer
<
T
>(
reader
,
startBound
,
length
,
returnNullIfFirstMissing
);
}
}
return
GetStructDeserializer
<
T
>(
reader
);
return
GetStructDeserializer
<
T
>();
}
}
...
@@ -631,7 +631,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
...
@@ -631,7 +631,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
}
}
}
}
private
static
Func
<
IDataReader
,
T
>
GetStructDeserializer
<
T
>(
IDataReader
reader
)
private
static
Func
<
IDataReader
,
T
>
GetStructDeserializer
<
T
>()
{
{
return
r
=>
return
r
=>
{
{
...
@@ -691,7 +691,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
...
@@ -691,7 +691,7 @@ private static int ExecuteCommand(IDbConnection cnn, IDbTransaction tranaction,
int
index
=
startBound
;
int
index
=
startBound
;
var
@try
=
il
.
BeginExceptionBlock
();
il
.
BeginExceptionBlock
();
// stack is empty
// stack is empty
il
.
Emit
(
OpCodes
.
Newobj
,
typeof
(
T
).
GetConstructor
(
Type
.
EmptyTypes
));
// stack is now [target]
il
.
Emit
(
OpCodes
.
Newobj
,
typeof
(
T
).
GetConstructor
(
Type
.
EmptyTypes
));
// stack is now [target]
bool
first
=
true
;
bool
first
=
true
;
...
@@ -827,8 +827,7 @@ public IEnumerable<T> Read<T>()
...
@@ -827,8 +827,7 @@ public IEnumerable<T> Read<T>()
{
{
if
(
reader
==
null
)
throw
new
ObjectDisposedException
(
GetType
().
Name
);
if
(
reader
==
null
)
throw
new
ObjectDisposedException
(
GetType
().
Name
);
if
(
consumed
)
throw
new
InvalidOperationException
(
"Each grid can only be iterated once"
);
if
(
consumed
)
throw
new
InvalidOperationException
(
"Each grid can only be iterated once"
);
var
identity
=
new
Identity
(
sql
,
connection
,
typeof
(
T
),
null
);
var
deserializer
=
GetDeserializer
<
T
>(
reader
);
var
deserializer
=
SqlMapper
.
GetDeserializer
<
T
>(
identity
,
reader
);
consumed
=
true
;
consumed
=
true
;
return
ReadDeferred
(
gridIndex
,
deserializer
);
return
ReadDeferred
(
gridIndex
,
deserializer
);
}
}
...
...
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