I have a SQL Server database (School) that is used in several EF5 tutorials (I should add helpful tutorials).
I have two VS2012 web projects that have an identical page. This web page uses a stored procedure (the GetStudentGrades sproc in the School database).
In one project, I added the Entity Framework for the School database directly to the project and then added the complex type for the stored procedure.
I also created a class library containing only the Entity Framework for the School database + the complex type for the stored procedure. I following exactly the same steps to create the data model in both instances.
When I run the project/web page which contains the Entity Framework directly, the web page retrieves and student grades and displays them on the web page just fine.
When I run the project/web page which contains the reference to the compiled class library that contains the Entity Framework data model, I receive compiler errors. A screen capture is included below.
Obviously my question(s) is (are): why am I receiving the errors and what is causing this difference? I am an experienced .Net developer (10 years) with similar experience with SQL Server. I have used EF4, LINQ to SQL, ADO.NET, etc. in many projects, so
I'm not a newbie. Does anyone know what am I missing?
As per my understanding this problem occurs since you have EF4+ and EF5 on the same machine. Remove EF4+ and this problem will be resolved. I have also faced this type of problem.
It may help you.
.Net Professional & Cosultant
Blog: Dot Net TricksWindows Apps Please "Mark As Answer" if my suggestions helps you
I appreciate the suggestion and would like to try this, but I must be pretty ignorant because I cannot find a way to remove EF4+. It is not listed as a "Feature" in Windows and it is not listed as an "Installed Program".
Where can I find it to uninstall it? Is there a folder somewhere I can delete or just rename?
Please make sure that you've downloaded the EntityFramework's dll from NuGet. Please make sure that your version of the downloaded dll fits your current project.
I have used NuGet to install EF5 and remade the .dll that contains the .edmx for the School database. I then included this .dll in a website application for use. The attached screen capture contains the compiler errors. The result is pretty much the same
as before, so I would guess from the results that I already had EF5 correctly installed on this machine. As a note only, there still is no entry in my Installed Programs list in the Control Panel for Entity Framework 5.
Is anyone has any additional ideas of what I can try to make this work, I will be happy to try them. Occasionally (such as during the last few days) productive work will get in the way of my "R & D" efforts and delay any subsequent postings.
LLahman
Member
38 Points
40 Posts
Problems compiling EF5 database first model as class library and using in web project
Jan 20, 2013 06:33 PM|LINK
I have a SQL Server database (School) that is used in several EF5 tutorials (I should add helpful tutorials).
I have two VS2012 web projects that have an identical page. This web page uses a stored procedure (the GetStudentGrades sproc in the School database).
In one project, I added the Entity Framework for the School database directly to the project and then added the complex type for the stored procedure.
I also created a class library containing only the Entity Framework for the School database + the complex type for the stored procedure. I following exactly the same steps to create the data model in both instances.
When I run the project/web page which contains the Entity Framework directly, the web page retrieves and student grades and displays them on the web page just fine.
When I run the project/web page which contains the reference to the compiled class library that contains the Entity Framework data model, I receive compiler errors. A screen capture is included below.
Obviously my question(s) is (are): why am I receiving the errors and what is causing this difference? I am an experienced .Net developer (10 years) with similar experience with SQL Server. I have used EF4, LINQ to SQL, ADO.NET, etc. in many projects, so I'm not a newbie. Does anyone know what am I missing?
pro.shailend...
Participant
998 Points
188 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 21, 2013 03:07 AM|LINK
As per my understanding this problem occurs since you have EF4+ and EF5 on the same machine. Remove EF4+ and this problem will be resolved. I have also faced this type of problem.
It may help you.
Blog: Dot Net Tricks Windows Apps
Please "Mark As Answer" if my suggestions helps you
LLahman
Member
38 Points
40 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 21, 2013 10:58 AM|LINK
I appreciate the suggestion and would like to try this, but I must be pretty ignorant because I cannot find a way to remove EF4+. It is not listed as a "Feature" in Windows and it is not listed as an "Installed Program".
Where can I find it to uninstall it? Is there a folder somewhere I can delete or just rename?
Lynn
pro.shailend...
Participant
998 Points
188 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 21, 2013 03:31 PM|LINK
I am able to find the EF4+ with in installed programs list. Could you tell me which version of EF are you using?
Blog: Dot Net Tricks Windows Apps
Please "Mark As Answer" if my suggestions helps you
LLahman
Member
38 Points
40 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 21, 2013 08:45 PM|LINK
Windows 8, 64-bit, VS2012, EF5, SQL Server 2008 R2, Telerik (ORM installed, not used at all).
I do have an entry for "Entity Framework Designer for Visual Studio 2012 - enu", but nothing else whatsoever.
What is the full name of the entry you have in the installed programs list?
Thanks again for persisting on this one.
Lynn
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 22, 2013 02:11 AM|LINK
Hi,
Please make sure that you've downloaded the EntityFramework's dll from NuGet. Please make sure that your version of the downloaded dll fits your current project.
LLahman
Member
38 Points
40 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 22, 2013 10:59 AM|LINK
Before I do that, I have attached a screen capture of the properties of the EntityFramework.dll in my .net 4.5 projects. Is this the correct .dll?
Thanks!
Lynn
thaicarrot
Contributor
5120 Points
1459 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 22, 2013 11:13 AM|LINK
I have two VS2012 web projects that have an identical page. This web page uses a stored procedure (the GetStudentGrades sproc in the School database).
Because of you code contains a few code that from different EF. That is why it is conflict. And seems like the assemblies isn't there.
Return data from stored procedure, the return data will be complexType. Start from there that is the point.
Weera
Veera Pallat...
Participant
769 Points
201 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 22, 2013 12:19 PM|LINK
Hi,
You can install/Uninstall the EntityFramework using NuGet Package Manager.
Please find the following link for installing EntityFrameWork using NuGet, Before that you need to have NuGet Manager
http://nuget.org/packages/EntityFramework/5.0.0
Veera Pallati
LLahman
Member
38 Points
40 Posts
Re: Problems compiling EF5 database first model as class library and using in web project
Jan 26, 2013 03:47 PM|LINK
I have used NuGet to install EF5 and remade the .dll that contains the .edmx for the School database. I then included this .dll in a website application for use. The attached screen capture contains the compiler errors. The result is pretty much the same as before, so I would guess from the results that I already had EF5 correctly installed on this machine. As a note only, there still is no entry in my Installed Programs list in the Control Panel for Entity Framework 5.
Is anyone has any additional ideas of what I can try to make this work, I will be happy to try them. Occasionally (such as during the last few days) productive work will get in the way of my "R & D" efforts and delay any subsequent postings.