ErikEJ / EntityFramework6PowerTools

This is the codebase for Entity Framework 6 Power Tools Community Edition, and modern EF 6 providers for SQL Server and SQL Server Compact
Other
183 stars 27 forks source link

No connection string named 'DBContext' could be found in the application config file. #39

Closed trinhpham closed 5 years ago

trinhpham commented 6 years ago

Hello, I installed the latest release on VS Marketplace and face this problem when try with my project. Clone the source code and debug it tell me that there are some problems:

  1. The latest source code on branch community uses GetServiceAsync to get the DTE object, however, it doesn't wait for the object available before checking null => Fixed by adding await keyword
  2. The ConfigurationManager somehow doesn't load my connectionstrings although the call to ConfigurationManager.OpenMappedExeConfiguration is succeeded. This cause the DBContext constructor cannot see my connection string and throws this error => Temporary fix by update ConfigurationManager.ConnectionStrings

I don't have enough knowledge to dig deeper into the issue, so I would like to post it here for any experts who could completely solve this issue.

My environment:

You could find my fix at this forked repo A working build (tested on my computer only) could be downloaded here As I don't think I found the root cause, so I don't create a PR for this. Just let me know if you want one.

ErikEJ commented 6 years ago

Thank, I have fixed the async bug in the latest commit.

Could you share a project that demonstrates your config issue?

trinhpham commented 5 years ago

@ErikEJ Sorry for this late response. There are a lot of things in my plate now. My project is quite complex and cannot be opensource. I'll try to make a sample with the issue and let you know as soon as I have time.

ErikEJ commented 5 years ago

Closing as the requested information was never supplied