From bd98413035a8bd3ce98ef111d49d75ec3efeda95 Mon Sep 17 00:00:00 2001 From: Christian Schou Date: Sun, 9 Oct 2022 12:44:31 +0200 Subject: [PATCH] Fix Date and Time Handling for PostgreSQL Npgsql 6.0 introduced some important changes to how timestamps are mapped. I have added a Switch to enable the legacy timestamp behavior in order to store values in the database. --- Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Program.cs b/Program.cs index f3f20d4..536f88b 100644 --- a/Program.cs +++ b/Program.cs @@ -9,6 +9,8 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddDbContext(); +AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); + builder.Services.AddCors(); builder.Services.AddControllers().AddJsonOptions(x => {