Friday, October 2, 2009

Adding an Entity Data Model to an MVC Application

When we try to access an Entity from a View, we get the following error :

Compiler Error Message: CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

In order to allow the Entities in our Model to be accessible/accessed by the View, we need to add the following reference in the Web.Config file :

<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

No comments:

Post a Comment