Skip to content

Commit

Permalink
Merge pull request #6426 from aspnetboilerplate/doc/6357
Browse files Browse the repository at this point in the history
Updated PostgreSQL document for Npgsql datetime change
  • Loading branch information
ismcagdas committed Apr 13, 2022
2 parents 65fd70a + adfdcb2 commit d66bca7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/WebSite/EF-Core-PostgreSql-Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Change the connection string to your PostgreSQL connection in ***.Web.Mvc/appset
}
```

### Configure DateTime Handling

Starting from **Npgsql** 6.0, Npgsql changed the datetime handling, see the related [issue](https://github.com/npgsql/efcore.pg/issues/2000). This causes an exception in AspNet Boilerplate's default template. So, you need to switch back to old behavior by following [https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic](https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic). Basically you need to set;

````c#
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
````

### Create Database

Before you create the database, you should change the max length of the "Value" property of ApplicationLanguageText by adding the following lines to DbContext.
Expand Down

0 comments on commit d66bca7

Please sign in to comment.