From 34886cbba2a0fb530d8cb0df48f3499fdde6bed3 Mon Sep 17 00:00:00 2001
From: claudiamurialdo <33756655+claudiamurialdo@users.noreply.github.com>
Date: Tue, 7 May 2024 09:43:10 -0300
Subject: [PATCH] Update Npgsql Version 3.2.7 to 8.0.2 (#980)
* Update Npgsql Version=3.2.7 to 8.0.2
* Disable infinity conversions for datetime
https://www.npgsql.org/efcore/release-notes/6.0.html?tabs=annotations
(cherry picked from commit 00f416fed7ee6535d542a05d951f3ea15892caf4)
---
dotnet/src/dotnetcore/GxClasses/GxClasses.csproj | 4 ++--
.../src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dotnet/src/dotnetcore/GxClasses/GxClasses.csproj b/dotnet/src/dotnetcore/GxClasses/GxClasses.csproj
index 37eb56d95..f716f12ee 100644
--- a/dotnet/src/dotnetcore/GxClasses/GxClasses.csproj
+++ b/dotnet/src/dotnetcore/GxClasses/GxClasses.csproj
@@ -161,7 +161,7 @@
-
+
@@ -170,7 +170,7 @@
-
+
diff --git a/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs b/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs
index d61eedaf5..f89acc4dd 100644
--- a/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs
+++ b/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs
@@ -587,6 +587,9 @@ public override string ConcatOp(int pos)
sealed internal class PostgresqlConnectionWrapper : GxAbstractConnectionWrapper
{
static readonly IGXLogger log = GXLoggerFactory.GetLogger();
+#if NETCORE
+ const string INFINITY_CONVERSIONS = "Npgsql.DisableDateTimeInfinityConversions";
+#endif
public PostgresqlConnectionWrapper()
{
_connection = (IDbConnection)ClassLoader.CreateInstance(GxPostgreSql.NpgsqlAssembly, "Npgsql.NpgsqlConnection");
@@ -597,6 +600,9 @@ public PostgresqlConnectionWrapper(String connectionString, GxConnectionCache co
try
{
_connection = (IDbConnection)ClassLoader.CreateInstance(GxPostgreSql.NpgsqlAssembly, "Npgsql.NpgsqlConnection", new object[] { connectionString });
+#if NETCORE
+ AppContext.SetSwitch(INFINITY_CONVERSIONS, true);
+#endif
m_isolationLevel = isolationLevel;
m_connectionCache = connCache;
}