Skip to content

Commit

Permalink
Fix Date and Time Handling for PostgreSQL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Christian-Schou committed Oct 9, 2022
1 parent f55fa9a commit bd98413
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Program.cs
Expand Up @@ -9,6 +9,8 @@
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<LibraryContext>();
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

builder.Services.AddCors();
builder.Services.AddControllers().AddJsonOptions(x =>
{
Expand Down

0 comments on commit bd98413

Please sign in to comment.