When I use the Entity Framework Profiler 3.0 to log the real SQL statement in background, sometimes I give this exception:
Message: unable to determine the provider name for provider factory of type 'system.data.sqlclient.sqlclientfactory'.
Source: EntityFrameWork.
I give this error when I run the project in visual studio 2015 debugging mode, it displays a file browser to locate r5wldbbb.5.cs
. I don't know what's this file and also it doesn't exist in Entity Framework Profiler
folder. So when I cancel it I give the above exception and raise this error:
r5wldbbb.5.cs not found.
You need to find r5wldbbb.5.cs to view the source for the current call stack frame.
However, when I cancel the Entity Framework Profiler
I don't give this error.
I use these programe:
Visual Studio 2015.
MSSQL Server 2014.
EntityFramework 6.
Any helps appreciated.
I finally fixed it.
The trick is to update the way you get and open the connection to the database:
var connectionString = ConfigurationManager.ConnectionStrings["yourContextName"].ConnectionString;
var connectionFactoryService = (IDbConnectionFactory)DbConfiguration.DependencyResolver.GetService(typeof(IDbConnectionFactory);
var DbConn = connectionFactoryService.CreateConnection(connectionString);
Let me know if it works for you too :) Also, don't forget to update the EF profiler to the latest version using NuGet.