Entity Framework from scratch Part 4 EF4 Multi Layered – System.Data.Entity not referenced
juli 21, 2010
As i mentioned in the previous post, there seems to be a problem when you work with Multi layered Solutions in the Entity Framework. You need to add the Entity references to all the solutions in your project, but i found another small problem when creating a web front to your application.
I’ve built this app with EF4 features with web functionality.
When i debug my code, the database connection works and the table rows are fetched, but my webpage displays an compilation error: CS0012: The type ‘System.Data.Objects.DataClasses.EntityObject’ is defined in an assembly that is not referenced. You must add a reference assembly to ‘System.Data.Entity, version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
You need to add extra code manualy to your Web.config file directly under the system.web
copy/paste the following code:
<compilation debug="true" targetFramework="4.0">
<add assembly="System.Web.Abstractions, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Entity, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
If you built and re-run the the app, the webpage is displayed correctly.
4 Replies to “Entity Framework from scratch Part 4 EF4 Multi Layered – System.Data.Entity not referenced”
another simply way is to add reference “system.data.entity” AND make sure, in it’s properties, “copy local” set to true.
It didn’t work at first, but now the reference seems to work. thanks for the comment! 😉
Helpful blog, bookmarked the website with hopes to read more!
Thanks, keep an eye out, we update the site regularly with more cool codesnippets and new technologies.