From 9a217a7a716575a09908e1178d47c09381b221c1 Mon Sep 17 00:00:00 2001 From: Douglas Gaskell <1400380+douglasg14b@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:02:13 -0800 Subject: [PATCH] Add warning for data source gotcha --- conceptual/EFCore.PG/mapping/nts.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conceptual/EFCore.PG/mapping/nts.md b/conceptual/EFCore.PG/mapping/nts.md index 4a08c52c..9555367c 100644 --- a/conceptual/EFCore.PG/mapping/nts.md +++ b/conceptual/EFCore.PG/mapping/nts.md @@ -13,6 +13,9 @@ To use the NetTopologySuite plugin, add the [Npgsql.EntityFrameworkCore.PostgreS ### [NpgsqlDataSource](#tab/with-datasource) +> [!WARNING] +> Ensure you build your data source `dataSourceBuilder.Build();` _outside_ of the `AddDbContext()`` configure callback otherwise a new ServiceProvider will be created for each DbContext instance + Since version 7.0, NpgsqlDataSource is the recommended way to use Npgsql. When using NpsgqlDataSource, NetTopologySuite currently has to be configured twice - once at the EF level, and once at the underlying ADO.NET level (there are plans to improve this): ```c#