dylan
July 26, 2016, 8:19am
1
I have the following helper methods used to create statements that I can batch later on:
public static string ToUpdateStatement<T>(T item)
{
return SqlServerDialect.Provider.SqlExpression<T>().ToUpdateStatement(item);
}
public static string ToInsertStatement<T>(T item)
{
return SqlServerDialect.Provider.ToInsertRowStatement(null, item);
}
However the ToUpdateStatement method is now missing in v4.0.60. Is there an alternative method somewhere?
mythz
July 26, 2016, 6:09pm
2
We’ve had to remove these APIs after we migrated all of OrmLite to parameterized queries as the SQL is now dependent on the db parameters and is no longer self-contained into a single SQL statement.
I’ll see if I can have a look at creating an API that merges the param values into inline SQL statement.
mythz
July 26, 2016, 7:55pm
3
I’ve just added support for ToInsertStatement/ToUpdateStatement in this commit .
Which now lets you use the APIs on IDbConnection
or dialect provider to merge SQL params into an inline SQL statement, e.g:
var updateSql = db.ToUpdateStatement(item);
var insertSql = db.ToInsertStatement(item);
This change is available from v4.0.61 that’s now available on MyGet .
1 Like
dylan
July 26, 2016, 8:08pm
4
That’s awesome thanks Demis. Much appreciated. I can get back to batching statements
1 Like