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
fc38c423
Commit
fc38c423
authored
Mar 31, 2018
by
Sergey
Committed by
Nick Craver
Mar 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing unjustified use of AppendFormat in StringBuilder class (#989)
parent
6e9099d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
SqlMapperExtensions.Async.cs
Dapper.Contrib/SqlMapperExtensions.Async.cs
+3
-3
SqlMapperExtensions.cs
Dapper.Contrib/SqlMapperExtensions.cs
+3
-3
No files found.
Dapper.Contrib/SqlMapperExtensions.Async.cs
View file @
fc38c423
...
@@ -246,7 +246,7 @@ public static partial class SqlMapperExtensions
...
@@ -246,7 +246,7 @@ public static partial class SqlMapperExtensions
var
property
=
nonIdProps
[
i
];
var
property
=
nonIdProps
[
i
];
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
if
(
i
<
nonIdProps
.
Count
-
1
)
if
(
i
<
nonIdProps
.
Count
-
1
)
sb
.
Append
Format
(
", "
);
sb
.
Append
(
", "
);
}
}
sb
.
Append
(
" where "
);
sb
.
Append
(
" where "
);
for
(
var
i
=
0
;
i
<
keyProperties
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
keyProperties
.
Count
;
i
++)
...
@@ -254,7 +254,7 @@ public static partial class SqlMapperExtensions
...
@@ -254,7 +254,7 @@ public static partial class SqlMapperExtensions
var
property
=
keyProperties
[
i
];
var
property
=
keyProperties
[
i
];
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
if
(
i
<
keyProperties
.
Count
-
1
)
if
(
i
<
keyProperties
.
Count
-
1
)
sb
.
Append
Format
(
" and "
);
sb
.
Append
(
" and "
);
}
}
var
updated
=
await
connection
.
ExecuteAsync
(
sb
.
ToString
(),
entityToUpdate
,
commandTimeout
:
commandTimeout
,
transaction
:
transaction
).
ConfigureAwait
(
false
);
var
updated
=
await
connection
.
ExecuteAsync
(
sb
.
ToString
(),
entityToUpdate
,
commandTimeout
:
commandTimeout
,
transaction
:
transaction
).
ConfigureAwait
(
false
);
return
updated
>
0
;
return
updated
>
0
;
...
@@ -301,7 +301,7 @@ public static partial class SqlMapperExtensions
...
@@ -301,7 +301,7 @@ public static partial class SqlMapperExtensions
var
property
=
keyProperties
[
i
];
var
property
=
keyProperties
[
i
];
sb
.
AppendFormat
(
"{0} = @{1}"
,
property
.
Name
,
property
.
Name
);
sb
.
AppendFormat
(
"{0} = @{1}"
,
property
.
Name
,
property
.
Name
);
if
(
i
<
keyProperties
.
Count
-
1
)
if
(
i
<
keyProperties
.
Count
-
1
)
sb
.
Append
Format
(
" AND "
);
sb
.
Append
(
" AND "
);
}
}
var
deleted
=
await
connection
.
ExecuteAsync
(
sb
.
ToString
(),
entityToDelete
,
transaction
,
commandTimeout
).
ConfigureAwait
(
false
);
var
deleted
=
await
connection
.
ExecuteAsync
(
sb
.
ToString
(),
entityToDelete
,
transaction
,
commandTimeout
).
ConfigureAwait
(
false
);
return
deleted
>
0
;
return
deleted
>
0
;
...
...
Dapper.Contrib/SqlMapperExtensions.cs
View file @
fc38c423
...
@@ -440,7 +440,7 @@ private static string GetTableName(Type type)
...
@@ -440,7 +440,7 @@ private static string GetTableName(Type type)
var
property
=
nonIdProps
[
i
];
var
property
=
nonIdProps
[
i
];
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
if
(
i
<
nonIdProps
.
Count
-
1
)
if
(
i
<
nonIdProps
.
Count
-
1
)
sb
.
Append
Format
(
", "
);
sb
.
Append
(
", "
);
}
}
sb
.
Append
(
" where "
);
sb
.
Append
(
" where "
);
for
(
var
i
=
0
;
i
<
keyProperties
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
keyProperties
.
Count
;
i
++)
...
@@ -448,7 +448,7 @@ private static string GetTableName(Type type)
...
@@ -448,7 +448,7 @@ private static string GetTableName(Type type)
var
property
=
keyProperties
[
i
];
var
property
=
keyProperties
[
i
];
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
if
(
i
<
keyProperties
.
Count
-
1
)
if
(
i
<
keyProperties
.
Count
-
1
)
sb
.
Append
Format
(
" and "
);
sb
.
Append
(
" and "
);
}
}
var
updated
=
connection
.
Execute
(
sb
.
ToString
(),
entityToUpdate
,
commandTimeout
:
commandTimeout
,
transaction
:
transaction
);
var
updated
=
connection
.
Execute
(
sb
.
ToString
(),
entityToUpdate
,
commandTimeout
:
commandTimeout
,
transaction
:
transaction
);
return
updated
>
0
;
return
updated
>
0
;
...
@@ -497,7 +497,7 @@ private static string GetTableName(Type type)
...
@@ -497,7 +497,7 @@ private static string GetTableName(Type type)
var
property
=
keyProperties
[
i
];
var
property
=
keyProperties
[
i
];
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
adapter
.
AppendColumnNameEqualsValue
(
sb
,
property
.
Name
);
//fix for issue #336
if
(
i
<
keyProperties
.
Count
-
1
)
if
(
i
<
keyProperties
.
Count
-
1
)
sb
.
Append
Format
(
" and "
);
sb
.
Append
(
" and "
);
}
}
var
deleted
=
connection
.
Execute
(
sb
.
ToString
(),
entityToDelete
,
transaction
,
commandTimeout
);
var
deleted
=
connection
.
Execute
(
sb
.
ToString
(),
entityToDelete
,
transaction
,
commandTimeout
);
return
deleted
>
0
;
return
deleted
>
0
;
...
...
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