I'm creating my first asp.net MVC website(the version 3).
I'm using Entity Framework to get data from my database, so for now, I've a movies list in my database.
I'm trying to do a page which display the list of these movies.
So, the controller seems to be OK, it returns a View(IEnumerable).
In the view, I specified the type of my model:
@model IEnumerable
Movie is a class generated with a T4 template from my edmx, so it is heriting from EntityObject.
Now, when I try to display my page, I'm getting an error, indicating me that I've to import System.Data.Entity:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0012: Le type 'System.Data.Objects.DataClasses.EntityObject' est défini dans un assembly qui n'est pas référencé. Vous devez ajouter une référence à l'assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Source Error:
Line 27: Line 28: Line 29:
public class _Page_Views_Movie_List_cshtml : System.Web.Mvc.WebViewPage> { Line 30: Line 31: #line hiddenSource File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\93402ec0\8f8e48f4\App_Web_list.cshtml.9612c299.pwpwk-k5.0.cs Line: 29
But, I've referenced this dll in my project and i've the corresponding using in my controller.
I tried to put this using in the cshtml: @using System.Data.Entity but it doesn't compile with(cannot find Entity in System.Data)
So what should I do?
all my projects are .Net 4(not the client profile)
ASP.NET MVC 3 is a framework for building scalable, standards-based web applications using well-established design patterns and the power of ASP.NET and the . NET Framework. It installs side-by-side with ASP.NET MVC 2, so get started using it today!
ASP.NET MVC is no longer in active development.
ASP.NET MVC 5 is a web framework based on Model-View-Controller (MVC) architecture. Developers can build dynamic web applications using ASP.NET MVC framework that enables a clean separation of concerns, fast development, and TDD friendly.
add the following line to your web.config
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With