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
7b5b2297
Commit
7b5b2297
authored
Apr 20, 2011
by
Sam Saffron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow setting of internal and private properties
parent
0e9de354
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
SqlMapper.cs
Dapper/SqlMapper.cs
+2
-2
Tests.cs
Tests/Tests.cs
+19
-0
No files found.
Dapper/SqlMapper.cs
View file @
7b5b2297
...
...
@@ -403,8 +403,8 @@ private static object GetStructDeserializer<T>(IDataReader reader)
var
il
=
dm
.
GetILGenerator
();
var
properties
=
typeof
(
T
)
.
GetProperties
(
BindingFlags
.
Public
|
BindingFlags
.
Instance
)
.
Select
(
p
=>
new
{
Name
=
p
.
Name
,
Setter
=
p
.
GetSetMethod
(),
Type
=
p
.
PropertyType
})
.
GetProperties
(
BindingFlags
.
Public
|
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
)
.
Select
(
p
=>
new
{
Name
=
p
.
Name
,
Setter
=
p
.
GetSetMethod
(
true
),
Type
=
p
.
PropertyType
})
.
Where
(
info
=>
info
.
Setter
!=
null
)
.
ToList
();
...
...
Tests/Tests.cs
View file @
7b5b2297
...
...
@@ -168,6 +168,25 @@ public void TestMassiveStrings()
.
IsEqualTo
(
str
);
}
class
TestObj
{
public
int
_internal
;
internal
int
Internal
{
set
{
_internal
=
value
;
}
}
public
int
_priv
;
internal
int
Priv
{
set
{
_priv
=
value
;
}
}
}
public
void
TestSetInternal
()
{
connection
.
ExecuteMapperQuery
<
TestObj
>(
"select 10 as [Internal]"
).
First
().
_internal
.
IsEqualTo
(
10
);
}
public
void
TestSetPrivate
()
{
connection
.
ExecuteMapperQuery
<
TestObj
>(
"select 10 as [Priv]"
).
First
().
_priv
.
IsEqualTo
(
10
);
}
}
...
...
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