.NET6 and DateTime problem. Cannot write DateTime with Kind=UTC to PostgreSQL type ‘timestamp without time zone’
A. Solved by adding AppContext.SetSwitch(“Npgsql.EnableLegacyTimestampBehavior”, true); to the Startup Configure method. B. Or in case you have no Startup class at all and all your initialization is inside Program.cs with a host builder then your file ending might look like: … //adding services etc var host = builder.Build(); AppContext.SetSwitch(“Npgsql.EnableLegacyTimestampBehavior”, true); … //your other scoped code … Read more