From 7badbccdf92f51412b678bff710bf1ac1aaaa2a0 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 18 Apr 2025 07:18:31 +0800 Subject: [PATCH] Update postgresql.md --- .../framework/data/entity-framework-core/postgresql.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/en/framework/data/entity-framework-core/postgresql.md b/docs/en/framework/data/entity-framework-core/postgresql.md index 8561e8bada..e25cc2c5fb 100644 --- a/docs/en/framework/data/entity-framework-core/postgresql.md +++ b/docs/en/framework/data/entity-framework-core/postgresql.md @@ -21,6 +21,15 @@ Find `UseSqlServer()` call in *YourProjectName*DbContextFactory.cs inside the `. > Depending on your solution structure, you may find more `UseSqlServer()` calls that needs to be changed. + +## EnableLegacyTimestampBehavior + +Please enable the `Npgsql.EnableLegacyTimestampBehavior` in `PreConfigureServices` method of your EF Core module and `DbContextFactory(IDesignTimeDbContextFactory)` class. + +`AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);` + +See https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic + ## Change the Connection Strings PostgreSql connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com](https://www.connectionstrings.com/postgresql/) for details of PostgreSql connection string options.