EntityFramework.Docs
EntityFramework.Docs copied to clipboard
Document changing connection/connection string
See https://github.com/dotnet/efcore/issues/6525 https://github.com/dotnet/efcore/issues/8427 https://github.com/dotnet/efcore/issues/8494
@ajcvickers just for a follow-up: any plans on moving forward with this?
@mviegas Yes. But other things are are higher priority right now.
Would really appreciate some documentation on how I can use a dbcontext pool in an ASP.NET Web API that needs to make sure correct connection string (we have 2 db users - masked and unmasked using dynamic data masking) is used for each request so connection string needs to be set each time taking user information from httpContext into account
Previous work around used in 5.0 has stopped working correctly in 6.0 (likely due to optimizations reusing existing connections as mentioned here https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-6-0-preview-4-performance-edition/#pooling-and-recycling-dbcontext-and-beyond) and rather then another work around Id like to see how to do it correctly
See https://github.com/dotnet/efcore/issues/19906 and follow issues referenced by it