Reputation: 3
how can I force DbContext to reread a Connection string from config without restart my application? I Change the Password in the config Connection string. I create a new instance of DbContext with the Name=xxxx constructor. But in DbContext.Database.ConnectionString still is the old Password!?
Upvotes: 0
Views: 2273
Reputation: 31620
Instead of passing the name of the connection string from the config file you can just pass the connection string to the ctor.
Upvotes: 1
Reputation: 11348
ConfigurationManager.RefreshSection("xxx")
EDIT:
Looks Like EF Caches, so even teh refresh doesnty work apparently. so try this EF Runtime connection strings
Upvotes: 0