System.Data.ProviderIncompatibleException Exception with Entity Framework Power Tools Beta 2 and Beta 3

Got stuck on this last night, when using Entity Framework Power Tools Beta 3, note: exception also happens in Beta 2 (http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d) to generate our POCO’s with Entity Framework 5.

Exception:

System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. —> System.InvalidOperationException: This operation requires a connection to the ‘master’ database. Unable to create a connection to the ‘master’ database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection. —> System.Data.SqlClient.SqlException: Login failed for user ‘blah’.

2-5-2013 6-31-42 PM

After falling in the rabbit hole of thinking it was a security issue and tweaking security in SSMS, well security wasn’t the issue, as long as the same SQL Account had rights to the master database, which it already did.

Solution: When you use the Entity Framework Power Tools, you have to check “Save Password” under “Connection Properties” and set “Persist Security Info” to true under “Advanced Properties. if you are using SQL Server Authentication. The tool is just using the standard SQL authentication dialog box, which has this checkbox, however it doesn’t save any of your credential information anywhere, so don’t expect anything to be pre-filled the next time you run the tool and get prompt for credentials.

  • Connection Properties

    2-5-2013 6-25-24 PM

  • Advanced Properties

    2-6-2013 11-39-07 AM

Why? Well when you run Entity Framework Power Tools to generate your POCO’s/data layer, it needs to access additional schema meta-data in your master database for the target database you are trying to generate for. This is obviously a bug, however if you don’t check “Save Password” then it doesn’t keep the password around when it authenticates with the master database for the schema or other related info it needs and therefore this exception. If you continue reading the stack trace, you will see that it states:

Unable to create a connection to the ‘master’ database because the original database connection has been opened and credentials have been removed from the connection string.

I googled and googled with no luck, and after fortunately finding out how to get around this, well hence this blog post. So for those that need to generate your model against a database that’s already in production with CodeFirst not being a viable solution, and getting this exception, here you go.

Happy Coding! 🙂

6 thoughts on “System.Data.ProviderIncompatibleException Exception with Entity Framework Power Tools Beta 2 and Beta 3

  1. Saved me! The big error message looked too freaking scary and I already knew other developers would have experienced it. I thought of how I could supply a new separate connection to this tool, but hey! you have a solution.

    Thanks for blogging it.

    Like

Comments are closed.