-
Notifications
You must be signed in to change notification settings - Fork 11
FL0012
Ed Ball edited this page Oct 23, 2021
·
2 revisions
Faithlife.Data has special support for formatted SQL, which should be used instead of passing a normal interpolated string to DbConnector.Command
. Consider using DbConnector.CommandFormat
instead.
Invalid:
var whereSql = visible ? "" : " where not deleted";
return connector.Command($"select count(*) from widgets{whereSql};").Query<long>();
Valid:
var whereSql = visible ? Sql.Empty : Sql.Raw(" where not deleted");
return connector.CommandFormat($"select count(*) from widgets{whereSql};").Query<long>();