❔ ConfigureTestServices not overriding connection string value :(
Hi!
I'm so lost as to why this isn't working.
Currently the RemoveDbContext removes the service as expected. And I get no exceptions from re-adding with the new config. I have debugged that if I change my development appsettings to the hardcoded connection string from the created container it works fine. But as soon as I change dev connection string back to what it is I get db login issues/couldn't establish connection issues. So it must not be overriding the config.
Any ideas on how I can fix this?
7 Replies
Don't just remove the context, you must also remove the context options
That's what actually contains your configured setup
Ah damn, I had thought it was something like this. Will give it a go boss. What type is context options?
DbContextOptions or something?
Yup
Cheers boss
Will let you know how it goes 🤣🤣
It's whatever type your context constructor takes in
Working! Thank you bro
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.