EntityFramework-Extensions
EntityFramework-Extensions copied to clipboard
DeleteFromQuery with Retry parameters
Hi ZZZ, I'm using your library with SQLITE and I'm running into some issues because sometimes the database is locked by another concurrent operation. When this happens, I get an exception like this:
Microsoft.Data.Sqlite.SqliteException: SQLite Error 5: 'database is locked'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(System.Int32 rc, SQLitePCL.sqlite3 db) at offset 83
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(System.Data.CommandBehavior behavior) at offset 544
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery() at offset 66
at Z.EntityFramework.Extensions.BatchDelete.Execute[T](System.Linq.IQueryable`1 query) at offset 503
at MC.Clio.CachedApiImplementations`2.<Refresh>d__7`1.MoveNext() at offset 897 in C:\Users\Tony Valenti\source\repos\AlphaDrive\ClioKit.Caching.Shared\CachedApiImplementations.cs:line 219:col 13
Is it possible for you to make a eitehr a DeleteFromQuery or BulkDelete overload that I can pass options to which control retry?
Thanks!
Hello @TonyValenti ,
Could you provide me the code for your best case solutions? Just to make that we will cover your requirement for this features.
I believe that yes, we can add a callback when such error occurs.
Best Regards,
Jonathan
Basically I'd like to be able to call it like this:
public virtual void DeleteAsync(Expression<Func<TStorage,bool>>
Where) {
//Preference #1
Context.BulkDelete(Where, options => {
options.RetryCount = OPTIONS_RETRYCOUNT;
options.RetryInterval = OPTIONS_RETRYINTERVAL;
});
//Alternative
this.Query.Where(Where)
.DeleteFromQuery(options => {
options.RetryCount = OPTIONS_RETRYCOUNT;
options.RetryInterval = OPTIONS_RETRYINTERVAL;
});
}
Always glad to help,
Thank you @TonyValenti ,
We will check what we can do to try to support it.
Best Regards,
Jonathan