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
9ac9c401
Commit
9ac9c401
authored
May 23, 2013
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nulls in dynamic
parent
36f51540
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
SqlMapper.cs
Dapper/SqlMapper.cs
+4
-1
Tests.cs
Tests/Tests.cs
+13
-0
No files found.
Dapper/SqlMapper.cs
View file @
9ac9c401
...
@@ -1550,13 +1550,16 @@ public object SetValue(string key, object value)
...
@@ -1550,13 +1550,16 @@ public object SetValue(string key, object value)
if
(
startBound
==
0
)
if
(
startBound
==
0
)
{
{
r
.
GetValues
(
values
);
r
.
GetValues
(
values
);
for
(
int
i
=
0
;
i
<
values
.
Length
;
i
++)
if
(
values
[
i
]
is
DBNull
)
values
[
i
]
=
null
;
}
}
else
else
{
{
var
begin
=
returnNullIfFirstMissing
?
1
:
0
;
var
begin
=
returnNullIfFirstMissing
?
1
:
0
;
for
(
var
iter
=
begin
;
iter
<
effectiveFieldCount
;
++
iter
)
for
(
var
iter
=
begin
;
iter
<
effectiveFieldCount
;
++
iter
)
{
{
values
[
iter
]
=
r
.
GetValue
(
iter
+
startBound
);
object
obj
=
r
.
GetValue
(
iter
+
startBound
);
values
[
iter
]
=
obj
is
DBNull
?
null
:
obj
;
}
}
}
}
return
new
DapperRow
(
table
,
values
);
return
new
DapperRow
(
table
,
values
);
...
...
Tests/Tests.cs
View file @
9ac9c401
...
@@ -555,6 +555,8 @@ class TestObj
...
@@ -555,6 +555,8 @@ class TestObj
public
int
_priv
;
public
int
_priv
;
private
int
Priv
{
set
{
_priv
=
value
;
}
}
private
int
Priv
{
set
{
_priv
=
value
;
}
}
private
int
PrivGet
{
get
{
return
_priv
;}
}
}
}
public
void
TestSetInternal
()
public
void
TestSetInternal
()
...
@@ -567,6 +569,17 @@ public void TestSetPrivate()
...
@@ -567,6 +569,17 @@ public void TestSetPrivate()
connection
.
Query
<
TestObj
>(
"select 10 as [Priv]"
).
First
().
_priv
.
IsEqualTo
(
10
);
connection
.
Query
<
TestObj
>(
"select 10 as [Priv]"
).
First
().
_priv
.
IsEqualTo
(
10
);
}
}
public
void
TestExpandWithNullableFields
()
{
var
row
=
connection
.
Query
(
"select null A, 2 B"
).
Single
();
((
int
?)
row
.
A
)
.
IsNull
();
((
int
?)
row
.
B
)
.
IsEqualTo
(
2
);
}
public
void
TestEnumeration
()
public
void
TestEnumeration
()
{
{
var
en
=
connection
.
Query
<
int
>(
"select 1 as one union all select 2 as one"
,
buffered
:
false
);
var
en
=
connection
.
Query
<
int
>(
"select 1 as one union all select 2 as one"
,
buffered
:
false
);
...
...
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