Skip to main content
edited tags
Link
Adriano Repetti
  • 67.5k
  • 20
  • 144
  • 215
Source Link
evolon
  • 1.6k
  • 1
  • 12
  • 18

c# - Entity Framework ConnectionString won't update after changing App.Config in runtime

I'm developing a WPF application which depends on Entity Framework for data access. At the first time installation I need to create a new connection string based on the User input, then updating App.Config according to that.

The problem is: after updating the App.Config file, Entity Framework doesn't detect the change and uses the old startup-time ConnectionString for instantiating the DbContext.

How can I update the Entity Framework's ConnectionString setting at runtime?