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

Commit 36875d9

Browse files
committed
reorder new API's so sql is always before sqlParams
1 parent 4f769ed commit 36875d9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/ServiceStack.OrmLite/Expressions/ReadExpressionCommandExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal static TKey Scalar<T, TKey>(this IDbCommand dbCmd,
8080
var ev = dbCmd.GetDialectProvider().SqlExpression<T>();
8181
ev.Select(field).Where(predicate);
8282
string sql = ev.SelectInto<T>();
83-
return dbCmd.Scalar<TKey>(ev.Params, sql);
83+
return dbCmd.Scalar<TKey>(sql, ev.Params);
8484
}
8585

8686
internal static long Count<T>(this IDbCommand dbCmd)
@@ -113,7 +113,7 @@ internal static long Count<T>(this IDbCommand dbCmd, Expression<Func<T, bool>> p
113113

114114
internal static long GetCount(this IDbCommand dbCmd, string sql, IEnumerable<IDbDataParameter> sqlParams = null)
115115
{
116-
return dbCmd.Column<long>(sqlParams, sql).Sum();
116+
return dbCmd.Column<long>(sql, sqlParams).Sum();
117117
}
118118

119119
internal static long RowCount<T>(this IDbCommand dbCmd, SqlExpression<T> expression)

src/ServiceStack.OrmLite/OrmLiteResultsFilterExtensions.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ internal static object ConvertTo(this IDbCommand dbCmd, Type refType, string sql
169169
}
170170
}
171171

172+
public static T Scalar<T>(this IDbCommand dbCmd, string sql, IEnumerable<IDbDataParameter> sqlParams)
173+
{
174+
if (sqlParams != null)
175+
SetParameters(dbCmd, sqlParams);
176+
177+
return dbCmd.Scalar<T>(sql);
178+
}
179+
172180
public static T Scalar<T>(this IDbCommand dbCmd, string sql = null)
173181
{
174182
if (sql != null)
@@ -198,13 +206,6 @@ public static object Scalar(this IDbCommand dbCmd, string sql = null)
198206
return dbCmd.ExecuteScalar();
199207
}
200208

201-
public static T Scalar<T>(this IDbCommand dbCmd, IEnumerable<IDbDataParameter> sqlParams, string sql = null)
202-
{
203-
SetParameters(dbCmd, sqlParams);
204-
205-
return Scalar<T>(dbCmd, sql);
206-
}
207-
208209
public static long ExecLongScalar(this IDbCommand dbCmd, string sql = null)
209210
{
210211
if (sql != null)
@@ -252,7 +253,7 @@ internal static List<T> Column<T>(this IDbCommand dbCmd, string sql = null)
252253
}
253254
}
254255

255-
internal static List<T> Column<T>(this IDbCommand dbCmd, IEnumerable<IDbDataParameter> sqlParams, string sql = null)
256+
internal static List<T> Column<T>(this IDbCommand dbCmd, string sql, IEnumerable<IDbDataParameter> sqlParams)
256257
{
257258
SetParameters(dbCmd, sqlParams);
258259

0 commit comments

Comments
 (0)