No Entity Framework provider found - calling a C# Com DLL from within VB6

com entity-framework vb6

Question

An error occurs when I try to utilize EF6 inside a C# Com visible DLL that I use in my VB6 application. The connection string is being passed in from the VB6 program, not app.config, as you may have seen.

I access the DBContext using the following C# code;

private static MyDataEntities CreateDb()
{ 
    return new MyDataEntities(EFConnectionString);
}

the EFConnectionString class

"metadata=res://*/vivModel.csdl|res://*/vivModel.ssdl|res://*/vivModel.msl;provider=System.Data.SqlClient;provider connection string='data source=MYPC\SQL2008R2;initial catalog=MyDatabase;user id=sa;password=mypassword;MultipleActiveResultSets=True;App=EntityFramework'"

The message of error is

[[Schema specified is not valid. Errors: vivModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.]]

1
1
1/7/2014 9:02:29 AM

Accepted Answer

By moving the dlls from the packages folder into the same folder as my Visual Basic executable, I was able to bypass this error. It was impossible for EntityFramework.sqlserver.dll to reach binddebug.

2
1/7/2014 9:03:32 AM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow