Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 55083b8

Browse files
committed
Merge duplicate populating params code, remove manual copy since using native Data params
1 parent c9d4148 commit 55083b8

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ protected string ConvertInExpressionToSql(MethodCallExpression m, object quotedC
15881588
var newName = DialectProvider.GetParam(Params.Count.ToString());
15891589
if (oldName != newName)
15901590
{
1591-
var pClone = p.Populate(DialectProvider.CreateParam());
1591+
var pClone = DialectProvider.CreateParam().PopulateWith(p);
15921592
subSelect = subSelect.Replace(oldName, newName);
15931593
pClone.ParameterName = newName;
15941594
Params.Add(pClone);
@@ -1812,19 +1812,6 @@ public static IDbDataParameter CreateParam(this IDbConnection db,
18121812

18131813
return to;
18141814
}
1815-
1816-
public static IDbDataParameter Populate(this IDbDataParameter p, IDbDataParameter to)
1817-
{
1818-
to.DbType = p.DbType;
1819-
to.ParameterName = p.ParameterName;
1820-
to.Value = p.Value;
1821-
to.Direction = p.Direction;
1822-
to.Precision = p.Precision;
1823-
to.Scale = p.Scale;
1824-
to.Size = p.Size;
1825-
1826-
return to;
1827-
}
18281815
}
18291816
}
18301817

src/ServiceStack.OrmLite/OrmLiteWriteCommandExtensions.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,7 @@ internal static int ExecuteSql(this IDbCommand dbCmd, string sql, IEnumerable<ID
220220
{
221221
dbCmd.CommandText = sql;
222222

223-
if (sqlParams != null)
224-
{
225-
dbCmd.Parameters.Clear();
226-
227-
foreach (var sqlParam in sqlParams)
228-
{
229-
var p = dbCmd.CreateParameter();
230-
p.PopulateWith(sqlParam);
231-
dbCmd.Parameters.Add(p);
232-
}
233-
}
223+
dbCmd.SetParameters(sqlParams);
234224

235225
if (Log.IsDebugEnabled)
236226
Log.DebugCommand(dbCmd);

0 commit comments

Comments
 (0)