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
f52d67f1
Commit
f52d67f1
authored
Sep 10, 2014
by
Derek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added output member expressions to DynamicParameters; included tests as well
parent
5472d2ab
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
273 additions
and
9 deletions
+273
-9
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+243
-9
Tests.cs
Tests/Tests.cs
+30
-0
No files found.
Dapper NET40/SqlMapper.cs
View file @
f52d67f1
This diff is collapsed.
Click to expand it.
Tests/Tests.cs
View file @
f52d67f1
...
@@ -1175,6 +1175,33 @@ public void TestSupportForDynamicParameters()
...
@@ -1175,6 +1175,33 @@ public void TestSupportForDynamicParameters()
p
.
Get
<
int
>(
"age"
).
IsEqualTo
(
11
);
p
.
Get
<
int
>(
"age"
).
IsEqualTo
(
11
);
}
}
[
ActiveTest
]
public
void
TestSupportForDynamicParametersOutputExpressions
()
{
var
bob
=
new
Person
{
Name
=
"bob"
,
PersonId
=
1
,
Address
=
new
Address
{
PersonId
=
2
}
};
var
p
=
new
DynamicParameters
(
bob
);
p
.
Output
(
bob
,
b
=>
b
.
PersonId
);
p
.
Output
(
bob
,
b
=>
b
.
Occupation
);
p
.
Output
(
bob
,
b
=>
b
.
NumberOfLegs
);
p
.
Output
(
bob
,
b
=>
b
.
Address
.
Name
);
p
.
Output
(
bob
,
b
=>
b
.
Address
.
PersonId
);
connection
.
Execute
(
@"
SET @Occupation = 'grillmaster'
SET @PersonId = @PersonId + 1
SET @NumberOfLegs = @NumberOfLegs - 1
SET @AddressName = 'bobs burgers'
SET @AddressPersonId = @PersonId"
,
p
);
bob
.
Occupation
.
IsEqualTo
(
"grillmaster"
);
bob
.
PersonId
.
IsEqualTo
(
2
);
bob
.
NumberOfLegs
.
IsEqualTo
(
1
);
bob
.
Address
.
Name
.
IsEqualTo
(
"bobs burgers"
);
bob
.
Address
.
PersonId
.
IsEqualTo
(
2
);
}
public
void
TestSupportForExpandoObjectParameters
()
public
void
TestSupportForExpandoObjectParameters
()
{
{
dynamic
p
=
new
ExpandoObject
();
dynamic
p
=
new
ExpandoObject
();
...
@@ -1231,6 +1258,9 @@ class Person
...
@@ -1231,6 +1258,9 @@ class Person
{
{
public
int
PersonId
{
get
;
set
;
}
public
int
PersonId
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Occupation
{
get
;
private
set
;
}
public
int
NumberOfLegs
=
2
;
public
Address
Address
{
get
;
set
;
}
}
}
class
Address
class
Address
...
...
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