0
votes

I have a project that contains my Entity Framework generated models and DBContext. I am attempting to reference that project from another project which has the following config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>

But anytime I instantiating the context: using (var db = new DataDB()) { ... } I get the error below:

An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll

Additional information: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

I also installed EF for my project. Not sure what else needs to be configured to get this working?

1

1 Answers

0
votes

If anyone is looking, you probably have created your model in a separate project. You need to add references for EntityFramework and EntityFramework.SqlServer