Wednesday, 13 November 2024

sql server error in api

error when there is no network.

transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call

  


 services.AddDbContextPool<DBContext>(options =>

        {
            options.UseMySql(
                mySqlConnectionStr, 
                ServerVersion.AutoDetect(mySqlConnectionStr),
                options => options.EnableRetryOnFailure(
                    maxRetryCount: 5,
                    maxRetryDelay: System.TimeSpan.FromSeconds(30),
                    errorNumbersToAdd: null)
                );
        });

No comments:

Post a Comment

Best UI