Add warning for data source gotcha in NetTopologySuite docs
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.
@douglasg14b the general idea seems to be covered in the basic usage docs:
You typically build a single data source, and then use that instance throughout your application
However, it's true that lots of people have run into this problem.
I think a better way here is to add a sample in the basic usage page specifically for DI with AddDbContext, plus a warning there. Then, from the various plugin pages, we can link to the part of the basic usage page. What do you think?
@roji The quote covers this only after one is knowledgeable about the problem IMHO. This is an unexpected side effect that violates that "rule", but not in a way that is obvious or intentional.
Which is why the suggested warning to avoid the pitfall.