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
f390f72e
Commit
f390f72e
authored
Oct 18, 2012
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented missing dictionary methods on FastExpando
parent
dc1d0270
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
SqlMapper.cs
Dapper/SqlMapper.cs
+6
-10
Tests.cs
Tests/Tests.cs
+18
-0
No files found.
Dapper/SqlMapper.cs
View file @
f390f72e
...
@@ -1222,7 +1222,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
...
@@ -1222,7 +1222,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
void
IDictionary
<
string
,
object
>.
Add
(
string
key
,
object
value
)
void
IDictionary
<
string
,
object
>.
Add
(
string
key
,
object
value
)
{
{
throw
new
NotImplementedException
(
);
data
.
Add
(
key
,
value
);
}
}
bool
IDictionary
<
string
,
object
>.
ContainsKey
(
string
key
)
bool
IDictionary
<
string
,
object
>.
ContainsKey
(
string
key
)
...
@@ -1237,7 +1237,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
...
@@ -1237,7 +1237,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
bool
IDictionary
<
string
,
object
>.
Remove
(
string
key
)
bool
IDictionary
<
string
,
object
>.
Remove
(
string
key
)
{
{
throw
new
NotImplementedException
(
);
return
data
.
Remove
(
key
);
}
}
bool
IDictionary
<
string
,
object
>.
TryGetValue
(
string
key
,
out
object
value
)
bool
IDictionary
<
string
,
object
>.
TryGetValue
(
string
key
,
out
object
value
)
...
@@ -1258,10 +1258,6 @@ public override IEnumerable<string> GetDynamicMemberNames()
...
@@ -1258,10 +1258,6 @@ public override IEnumerable<string> GetDynamicMemberNames()
}
}
set
set
{
{
if
(!
data
.
ContainsKey
(
key
))
{
throw
new
NotImplementedException
();
}
data
[
key
]
=
value
;
data
[
key
]
=
value
;
}
}
}
}
...
@@ -1272,12 +1268,12 @@ public override IEnumerable<string> GetDynamicMemberNames()
...
@@ -1272,12 +1268,12 @@ public override IEnumerable<string> GetDynamicMemberNames()
void
ICollection
<
KeyValuePair
<
string
,
object
>>.
Add
(
KeyValuePair
<
string
,
object
>
item
)
void
ICollection
<
KeyValuePair
<
string
,
object
>>.
Add
(
KeyValuePair
<
string
,
object
>
item
)
{
{
throw
new
NotImplementedException
(
);
data
.
Add
(
item
);
}
}
void
ICollection
<
KeyValuePair
<
string
,
object
>>.
Clear
()
void
ICollection
<
KeyValuePair
<
string
,
object
>>.
Clear
()
{
{
throw
new
NotImplementedException
();
data
.
Clear
();
}
}
bool
ICollection
<
KeyValuePair
<
string
,
object
>>.
Contains
(
KeyValuePair
<
string
,
object
>
item
)
bool
ICollection
<
KeyValuePair
<
string
,
object
>>.
Contains
(
KeyValuePair
<
string
,
object
>
item
)
...
@@ -1302,7 +1298,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
...
@@ -1302,7 +1298,7 @@ public override IEnumerable<string> GetDynamicMemberNames()
bool
ICollection
<
KeyValuePair
<
string
,
object
>>.
Remove
(
KeyValuePair
<
string
,
object
>
item
)
bool
ICollection
<
KeyValuePair
<
string
,
object
>>.
Remove
(
KeyValuePair
<
string
,
object
>
item
)
{
{
throw
new
NotImplementedException
(
);
return
data
.
Remove
(
item
);
}
}
#
endregion
#
endregion
...
@@ -3060,7 +3056,7 @@ public ConstructorInfo FindConstructor(string[] names, Type[] types)
...
@@ -3060,7 +3056,7 @@ public ConstructorInfo FindConstructor(string[] names, Type[] types)
/// <returns></returns>
/// <returns></returns>
public
SqlMapper
.
IMemberMap
GetConstructorParameter
(
ConstructorInfo
constructor
,
string
columnName
)
public
SqlMapper
.
IMemberMap
GetConstructorParameter
(
ConstructorInfo
constructor
,
string
columnName
)
{
{
throw
new
Not
Implemen
tedException
();
throw
new
Not
Suppor
tedException
();
}
}
/// <summary>
/// <summary>
...
...
Tests/Tests.cs
View file @
f390f72e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
using
System.Reflection
;
using
System.Reflection
;
using
System.Dynamic
;
using
System.Dynamic
;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
Microsoft.CSharp.RuntimeBinder
;
#if POSTGRESQL
#if POSTGRESQL
using
Npgsql
;
using
Npgsql
;
#endif
#endif
...
@@ -2120,6 +2121,23 @@ public void TestMultiSelectWithSomeEmptyGrids()
...
@@ -2120,6 +2121,23 @@ public void TestMultiSelectWithSomeEmptyGrids()
four
[
0
].
IsEqualTo
(
4
);
four
[
0
].
IsEqualTo
(
4
);
}
}
}
}
[
ActiveTest
]
public
void
TestDynamicMutation
()
{
var
obj
=
connection
.
Query
(
"select 1 as [a], 2 as [b], 3 as [c]"
).
Single
();
((
int
)
obj
.
a
).
IsEqualTo
(
1
);
IDictionary
<
string
,
object
>
dict
=
obj
;
dict
.
Remove
(
"a"
);
try
{
((
int
)
obj
.
a
).
IsEqualTo
(
1
);
throw
new
InvalidOperationException
(
"should have thrown"
);
}
catch
(
RuntimeBinderException
)
{
// pass
}
}
class
TransactedConnection
:
IDbConnection
class
TransactedConnection
:
IDbConnection
{
{
...
...
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