6

I have 2 projects in a solution one asp.net 5, and one class library project containing EFModel. I used install-package to install : "EntityFramework": "6.1.3", "EntityFramework.SqlServerCompact": "6.1.3" on both projects and have the connection string in both classlibrary\app.config and wwwroot\web.config I searched the internet some said placing:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="System.Data.SqlServerCe.4.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
    </providers>
  </entityFramework>​

in web.config solves the problem, I have this section in app.config and when I try to place this in web.config file I get angularjs inject error. My entity framework code gets me the error: "Schema specified is not valid. Errors: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure ... And I am not able to solve this, help Please.

5
  • Is this ASP.NET MVC 5 or ASP.NET 5(vNext)? If so then I guess you need to add frameworks dependency in project.json. Commented Oct 28, 2015 at 19:12
  • I have these dependencies already in Project.json file: "EntityFramework": "6.1.3", "EntityFramework.SqlServerCompact": "6.1.3" Commented Oct 28, 2015 at 19:18
  • Not sure how much this link is helpful stackoverflow.com/questions/20111583/… Commented Oct 28, 2015 at 19:31
  • @mz1378 If you are targeting Core framework, try targeting full version. Commented Oct 28, 2015 at 19:59
  • I have: "dnx451": { "dependencies": { "DataAccess": "1.0.0-*" } } in my project json. Commented Oct 28, 2015 at 20:01

2 Answers 2

13

I Solved my problem as bellow: Although I added EntityFramework and EntityFramework.SqlServerCompact using Nuget once for every project in the solution and my project.json says that: "EntityFramework": "6.1.3", "EntityFramework.SqlServerCompact": "6.1.3", But I noticed that Visual Studio did a nasty job of referencing all packages from the ClassLibrary project, So I copied all the assemblies from classlibrary project's bin to MainProject bin and add a reference to all of them through browsing, And Finally copied required Auto Generated configurations from ClassLibrary's app.config to MainProject's web.config and Problem Solved.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for sharing really helpful ! for me installing EntityFramework and EntityFramework.SqlServerCompact using Nuget Manager was sufficient .
1

usually this error occurs due to the Entityframework. follow the following

  1. Add entityframeworkcore from the NuGet,
  2. Add entityframeworkdesign.
  3. Add entityframework.sqlserver.compact

last give a rebuild for the solution the above method worked for me as I also found that issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.