diff --git a/GestionAsegasa/GestionAsegasa.vbproj b/GestionAsegasa/GestionAsegasa.vbproj index e3b61bb..d46b746 100644 --- a/GestionAsegasa/GestionAsegasa.vbproj +++ b/GestionAsegasa/GestionAsegasa.vbproj @@ -42,9 +42,9 @@ - - - + + + diff --git a/ServicioGestionAsegasa/ServicioGestionAsegasa.csproj b/ServicioGestionAsegasa/ServicioGestionAsegasa.csproj index b09878c..e6c3bc3 100644 --- a/ServicioGestionAsegasa/ServicioGestionAsegasa.csproj +++ b/ServicioGestionAsegasa/ServicioGestionAsegasa.csproj @@ -23,7 +23,7 @@ - + diff --git a/WSAsegasaVerifactu/WSAsegasaVerifactu.csproj b/WSAsegasaVerifactu/WSAsegasaVerifactu.csproj index daa08a5..51f2c01 100644 --- a/WSAsegasaVerifactu/WSAsegasaVerifactu.csproj +++ b/WSAsegasaVerifactu/WSAsegasaVerifactu.csproj @@ -6,12 +6,13 @@ enable dotnet-WSAsegasa-3170e77c-9190-48a1-9c66-26323b65ac5d win-x64;linux-x64 - 1.0.0.2 - 1.0.0.2 + 1.0.0.3 + 1.0.0.3 Manuel Tecnosis S.A Servicio de envío de facturas de asegasa al sistema Verifactu + - 2026-07-27 V 1.0.0.3 Se habilita EnableRetryOnFailure en la conexion a la bd y se aumenta el timeout a 60 segundos - 2026-06-15 V 1.0.0.2 Actualización librería tsUtilidades - 2026-05-19 V 1.0.0.1 Se cambian los logs de correo a tsnotificaciones. - 2026-05-19 V 1.0.0.0 Versión renombrada de wsasegasa a wsasegasaverifactu. @@ -29,8 +30,8 @@ - - + + diff --git a/bdAsegasa/bdAsegasa.csproj b/bdAsegasa/bdAsegasa.csproj index 566c986..943efd2 100644 --- a/bdAsegasa/bdAsegasa.csproj +++ b/bdAsegasa/bdAsegasa.csproj @@ -16,7 +16,7 @@ - + diff --git a/bdAsegasa/dbcontext/tscgestionasegasa.cs b/bdAsegasa/dbcontext/tscgestionasegasa.cs index d8283eb..5b5360d 100644 --- a/bdAsegasa/dbcontext/tscgestionasegasa.cs +++ b/bdAsegasa/dbcontext/tscgestionasegasa.cs @@ -15,6 +15,7 @@ using static System.Net.Mime.MediaTypeNames; using Microsoft.Extensions.Hosting; using bdAsegasa.db; using bdAsegasa.dbcontext; +using Pomelo.EntityFrameworkCore.MySql.Internal; namespace bdAsegasa { @@ -56,33 +57,45 @@ namespace bdAsegasa }); private static string? ConexionPorDefecto=null; - public static tscgestionasegasa NuevoContexto(string NombreConexion = "" ,bool Lazy = true, bool SoloLectura = false, bool ConEventoSavingChanges = false, string aplicaciones = "") + public static tscgestionasegasa NuevoContexto(string NombreConexion = "", bool Lazy = true, bool SoloLectura = false, bool ConEventoSavingChanges = false, string aplicaciones = "") { - string? cnx = null; - if (NombreConexion=="") + string cnx; + if (string.IsNullOrEmpty(NombreConexion)) { if (ConexionPorDefecto == null) ConexionPorDefecto = Conexion.ObtieneConexionDefecto(); - cnx = ConexionPorDefecto; + cnx = ConexionPorDefecto; } else { cnx = Conexion.ObtieneConexionDefecto(NombreConexion); } - - var ob = new DbContextOptionsBuilder(); - // ob.UseLoggerFactory(_myLoggerFactory); - // ob.UseInternalServiceProvider() - ob.UseMySql(cnx, Microsoft.EntityFrameworkCore.ServerVersion.Parse("5.7.0-mysql")); - if (Lazy) ob.UseLazyLoadingProxies(); - if (SoloLectura) ob.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); - var Opciones = ob.Options; - tscgestionasegasa bd = new tscgestionasegasa(Opciones); + + var optionsBuilder = new DbContextOptionsBuilder(); + + // Ejemplo con Pomelo.EntityFrameworkCore.MySql + optionsBuilder.UseMySql(cnx, ServerVersion.Parse("5.7.0-mysql"), mySqlOptions => + { + // Habilita reintentos transitorios (por defecto 3 reintentos) + mySqlOptions.EnableRetryOnFailure(); + + // Ajusta timeout de comando (segundos) + mySqlOptions.CommandTimeout(60); + + // Si quieres controlar número de reintentos y backoff: + // mySqlOptions.EnableRetryOnFailure(maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(5), errorNumbersToAdd: null); + }); + + if (Lazy) optionsBuilder.UseLazyLoadingProxies(); + if (SoloLectura) optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); + + var opciones = optionsBuilder.Options; + var bd = new tscgestionasegasa(opciones); bd.Aplicaciones = aplicaciones; if (ConEventoSavingChanges) bd.SavingChanges += GuardandoCambios; return bd; - } + //public static Datos.BBDD ObtieneBBDD(string NombreConexion) private static void GuardandoCambios(object? sender, SavingChangesEventArgs e) diff --git a/itsm/itsm.csproj b/itsm/itsm.csproj index 23997d9..37ea950 100644 --- a/itsm/itsm.csproj +++ b/itsm/itsm.csproj @@ -9,6 +9,6 @@ - + \ No newline at end of file