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
66c8b3f1
Commit
66c8b3f1
authored
Jul 03, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mono lacks SqlParameter.TypeName; apply that more flexibly
parent
a8043e02
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+11
-1
No files found.
Dapper NET40/SqlMapper.cs
View file @
66c8b3f1
...
@@ -4002,6 +4002,16 @@ public TableValuedParameter(DataTable table, string typeName)
...
@@ -4002,6 +4002,16 @@ public TableValuedParameter(DataTable table, string typeName)
this
.
table
=
table
;
this
.
table
=
table
;
this
.
typeName
=
typeName
;
this
.
typeName
=
typeName
;
}
}
static
readonly
Action
<
System
.
Data
.
SqlClient
.
SqlParameter
,
string
>
setTypeName
;
static
TableValuedParameter
()
{
var
prop
=
typeof
(
System
.
Data
.
SqlClient
.
SqlParameter
).
GetProperty
(
"TypeName"
,
BindingFlags
.
Instance
|
BindingFlags
.
Public
);
if
(
prop
!=
null
&&
prop
.
PropertyType
==
typeof
(
string
)
&&
prop
.
CanWrite
)
{
setTypeName
=
(
Action
<
System
.
Data
.
SqlClient
.
SqlParameter
,
string
>)
Delegate
.
CreateDelegate
(
typeof
(
Action
<
System
.
Data
.
SqlClient
.
SqlParameter
,
string
>),
prop
.
GetSetMethod
());
}
}
void
SqlMapper
.
ICustomQueryParameter
.
AddParameter
(
IDbCommand
command
,
string
name
)
void
SqlMapper
.
ICustomQueryParameter
.
AddParameter
(
IDbCommand
command
,
string
name
)
{
{
var
param
=
command
.
CreateParameter
();
var
param
=
command
.
CreateParameter
();
...
@@ -4012,7 +4022,7 @@ void SqlMapper.ICustomQueryParameter.AddParameter(IDbCommand command, string nam
...
@@ -4012,7 +4022,7 @@ void SqlMapper.ICustomQueryParameter.AddParameter(IDbCommand command, string nam
var
sqlParam
=
param
as
System
.
Data
.
SqlClient
.
SqlParameter
;
var
sqlParam
=
param
as
System
.
Data
.
SqlClient
.
SqlParameter
;
if
(
sqlParam
!=
null
)
if
(
sqlParam
!=
null
)
{
{
sqlParam
.
TypeName
=
typeName
;
if
(
setTypeName
!=
null
)
setTypeName
(
sqlParam
,
typeName
)
;
sqlParam
.
SqlDbType
=
SqlDbType
.
Structured
;
sqlParam
.
SqlDbType
=
SqlDbType
.
Structured
;
}
}
}
}
...
...
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