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
40282d19
Commit
40282d19
authored
Mar 30, 2015
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Precision and scale controls (fixes Issue #261)
parent
8ab859c7
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
46 deletions
+101
-46
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+24
-9
Tests.cs
Tests/Tests.cs
+77
-37
No files found.
Dapper NET40/SqlMapper.cs
View file @
40282d19
...
@@ -4457,6 +4457,9 @@ partial class ParamInfo
...
@@ -4457,6 +4457,9 @@ partial class ParamInfo
internal
Action
<
object
,
DynamicParameters
>
OutputCallback
{
get
;
set
;
}
internal
Action
<
object
,
DynamicParameters
>
OutputCallback
{
get
;
set
;
}
internal
object
OutputTarget
{
get
;
set
;
}
internal
object
OutputTarget
{
get
;
set
;
}
internal
bool
CameFromTemplate
{
get
;
set
;
}
internal
bool
CameFromTemplate
{
get
;
set
;
}
public
byte
?
Precision
{
get
;
set
;
}
public
byte
?
Scale
{
get
;
set
;
}
}
}
/// <summary>
/// <summary>
...
@@ -4529,20 +4532,30 @@ public void AddDynamicParams(object param)
...
@@ -4529,20 +4532,30 @@ public void AddDynamicParams(object param)
/// <summary>
/// <summary>
/// Add a parameter to this dynamic parameter list
/// Add a parameter to this dynamic parameter list
/// </summary>
/// </summary>
/// <param name="name"></param>
public
void
Add
(
string
name
,
object
value
,
DbType
?
dbType
,
ParameterDirection
?
direction
,
int
?
size
)
/// <param name="value"></param>
{
/// <param name="dbType"></param>
parameters
[
Clean
(
name
)]
=
new
ParamInfo
()
{
/// <param name="direction"></param>
Name
=
name
,
Value
=
value
,
ParameterDirection
=
direction
??
ParameterDirection
.
Input
,
/// <param name="size"></param>
DbType
=
dbType
,
Size
=
size
};
}
/// <summary>
/// Add a parameter to this dynamic parameter list
/// </summary>
public
void
Add
(
public
void
Add
(
#if CSHARP30
#if CSHARP30
string
name
,
object
value
,
DbType
?
dbType
,
ParameterDirection
?
direction
,
int
?
size
string
name
,
object
value
,
DbType
?
dbType
,
ParameterDirection
?
direction
,
int
?
size
,
byte
?
precision
,
byte
?
scale
#else
#else
string
name
,
object
value
=
null
,
DbType
?
dbType
=
null
,
ParameterDirection
?
direction
=
null
,
int
?
size
=
null
string
name
,
object
value
=
null
,
DbType
?
dbType
=
null
,
ParameterDirection
?
direction
=
null
,
int
?
size
=
null
,
byte
?
precision
=
null
,
byte
?
scale
=
null
#endif
#endif
)
)
{
{
parameters
[
Clean
(
name
)]
=
new
ParamInfo
()
{
Name
=
name
,
Value
=
value
,
ParameterDirection
=
direction
??
ParameterDirection
.
Input
,
DbType
=
dbType
,
Size
=
size
};
parameters
[
Clean
(
name
)]
=
new
ParamInfo
()
{
Name
=
name
,
Value
=
value
,
ParameterDirection
=
direction
??
ParameterDirection
.
Input
,
DbType
=
dbType
,
Size
=
size
,
Precision
=
precision
,
Scale
=
scale
};
}
}
static
string
Clean
(
string
name
)
static
string
Clean
(
string
name
)
...
@@ -4686,7 +4699,9 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
...
@@ -4686,7 +4699,9 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
if
(
param
.
Size
!=
null
)
if
(
param
.
Size
!=
null
)
{
{
p
.
Size
=
param
.
Size
.
Value
;
p
.
Size
=
param
.
Size
.
Value
;
}
}
if
(
param
.
Precision
!=
null
)
p
.
Precision
=
param
.
Precision
.
Value
;
if
(
param
.
Scale
!=
null
)
p
.
Scale
=
param
.
Scale
.
Value
;
}
}
else
else
{
{
...
...
Tests/Tests.cs
View file @
40282d19
This diff is collapsed.
Click to expand it.
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