We’re using the new? InsertAll() method. The Intelsense shows that it performs the Insert using a Transaction. Performance is much better. As this article documents, performance went from 85 rows a second to over 23000 per second.
But… we are also using a Compound unique Index for the purpose of rejecting duplicate rows.
The issue is: when combining these two techniques, the transaction can be aborted when a duplicate occurs. SqlLite has the ability to define a strategy for what happens when you get a conflict when performing this in a transaction.
http://www.sqlite.org/lang_conflict.html
We would like to use the IGNORE option -
When an applicable constraint violation occurs, the IGNORE resolution algorithm skips the one row that contains the constraint violation and continues processing subsequent rows of the SQL statement as if nothing went wrong. Other rows before and after the row that contained the constraint violation are inserted or updated normally. No error is returned when the IGNORE conflict resolution algorithm is used.
Is there any way to accomplish this with the existing InsertAll() method?
If not, I would be in your debt if this could be included in the next release.
My suggestion would be to have an overload of InsertAll that would allow the caller to provide a transaction handle and have the conflict resolution strategy.
e.g.
public enum SQLConflictResolution { Rollback,Abort,Fail,Ignore,Replace };
public static void InsertAll<T>(this IDbConnection dbConn, IEnumerable<T> objs,IDBTransaction trans,SQLConflictResolution conStategy);
Just in case we’ve not said this in the past… We LOVE ServiceStack, both the code and your way of doing things… Really looking forward to 5.0!!!