Add warning for data source gotcha in NetTopologySuite docs by douglasg14b · Pull Request #328 · npgsql/doc · GitHub
Skip to content

Add warning for data source gotcha in NetTopologySuite docs - #328

Open
douglasg14b wants to merge 1 commit into
npgsql:mainfrom
douglasg14b:TooManyServiceProvidersWarning
Open

douglasg14b wants to merge 1 commit into
npgsql:mainfrom
douglasg14b:TooManyServiceProvidersWarning

Conversation

@douglasg14b

@douglasg14b douglasg14b commented Dec 29, 2023 •

Copy link
Copy Markdown

We got hung up on this one for quite a while, it's an easy gotcha to run into if you are setting up NetTopologySuite in an existing application that obtains the connection string via DI inside of the configuring callback of AddDbContext.

Setting up the data source inside of the OnConfiguring callback causes the dependencies of the DbContextOptions to be different every time, causing a new ServiceProvider to be made for each DbContext which will eventually warn/error with the LogManyServiceProvidersCreated error in EF Core.

Please advise preferred verbiage and location.

@roji

roji commented Dec 29, 2023

Copy link
Copy Markdown
Member

@douglasg14b

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants