Issue connecting to a database using EntityFramework in a Plug-in

Hi everyone,

We are trying to use EntityFramework 6 to connect to an sqlce database.
The same code works in a standalone windows forms application but does not work in the plug-in.

We’ve installed all necessary packages and made sure that all references exist and are resolved.
The error we are getting is “No connection string named ‘MyEntities’ could be found in the application config file.”

It seems like it doesn’t look at the app.config file that contains the connection string.

We will appreciate some help… :slightly_smiling:



1 Like

The app.config file just contains hard coded strings that your database connection uses. Try directly using these strings in your code for making a connection.

Thanks, We’ve tried that as well and it made us run into another set of issues and mainly an error which says:

“Schema specified is not valid. Errors:
RhinoPlugin1.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlServerCe.4.0’. Make sure the provider is registered in the ‘entityFramework’ section of the application config file. See for more information.”

It seems like it still looks for the provider in the app.config file, even though we set it up in code dynamically.

Does using a plug-in means that the app.config file couldn’t be in use?

Thanks again.

That is correct. See this stackoverflow thread about app.config and DLLs