Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am working on a project where I have a Main console application, Biz class library and DBModel class library.

I installed latest EF in DBModel using NuGet and updated database with SQL server connection string (By making the DBModel set as start up project, without this it was taking sqlexpress always).

Now, In Biz project I have added a reference for DBModel and again added EF plus the connection string (as is in DBModel lib). However upon running the Console app I am getting "No Entity Framework provider found for the ADO.NET provider with invariant name" error.

Code in Biz project:

using (MyDBContext context = new MyDBContext())
            {
                Student s = new Student();
                s.Name = "ABCD";
                s.DOB = DateTime.Today;

                context.Students.Add(s); // throws the run-time exception
                context.SaveChanges();
            }


Please assist.

Thanks in advance !

What I have tried:

- Made DBModel project as startup project to run update-database command. Later again made console app as start up project.

- Installed EF in Biz class library and copied the connection string from DBModel and added in app.config of Biz lib.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900