Murali Murugesan
Murali Murugesan

Reputation: 22619

Error with Strongly Typed Entity Framework Object in Razor View

Creating the razor view with strongly typed of Entity Framework generated POCO gives the below error.

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

However i added System.Data, System.Data.Entity dlls into my MVC 3 project. In case if i use ViewModel object instead of EF Created POCO it is not showing error.

What is the problem of binding Entity Framework object in Razor View?

Edit: Reading Using Entity Model Object in ASP.Net MVC View Page is not helping me. What could i do here, Do i need to create another ViewModel for each POCO?

Upvotes: 0

Views: 255

Answers (1)

Forty-Two
Forty-Two

Reputation: 7605

Try adding

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

To the <system.web> section of your web.config

Upvotes: 1

Related Questions