i’m working on a Project based on Winform C# with Entity Framework, writing/reading data from a PostgreSQL database.
I’m gonna have low clients number (4/5) with a low traffic so i decide to use Serializable Isolation level in order to make it easier to develop and more safe, even if i’m gonna lose some performance.
Now i’m trying to handle “40001” Serialization error, and i’m trying to put a retry logic, but i know that EF has a Retry built-in logic, so i try to use EnableRetryOnFailure() but it seems it’s not working properly.
I tried to add in my OnConfiguring:
options.EnableRetryOnFailure(3, TimeSpan.FromSeconds(5), new List<string> { "40001" }))
But it seems that he’s not retrying but is firing an exception everytime.
Any idea or suggestion?
Thank you
This is my errore message:
fail: 21/06/2024 15:45:29.512 RelationalEventId.CommandError[20102] (Microsoft.EntityFrameworkCore.Database.Command)
Failed executing DbCommand (11ms) [Parameters=[@p0=’TEST CLIENT’ (Nullable = false), @p1=’OV24-00001′ (Nullable = false)], CommandType=’Text’, CommandTimeout=’30’]
INSERT INTO sales_orders (client_name, ov_number)
VALUES (@p0, @p1)
RETURNING id_sales_orders;