Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Data Model Wizard not creating tables in EDMX file

I'm trying the database first approach by creating an ADO.NET Entity Data Model using the wizard with the Adventureworks2012 DB.

Testing DB connection works, and the connection string is added to the App.Config.

I'm selecting all the tables except the ones marked as (dbo) AWBuildVersion, DatabaseLog, and ErrorLog.

When the wizard finishes the .edmx file is blank, and if I view the file in XML view the EntityContainer is empty.

After the model is created it returns this error in the output window:

Unable to generate the model because of the following exception: 'The table AdventureWorks2012.Production.Document is referenced by a relationship, but cannot be found.

I'm using VS 2010 & .NET Framework 4.0

like image 707
Shawn Avatar asked Dec 20 '12 05:12

Shawn


1 Answers

It seems that Entity Framework does not know how to deal with data types like hierarchyid set on a table field. I removed the Production.Document table for the list of entities to include solving my problem.

Note also that this reference below was for Adventureworks 2008R2 with EF version 1.0 from Code Plex SQL Sever, and I am using Adventureworks 2012 from the same CodePlex site using EF version 4.4.

Reference: http://msftdbprodsamples.codeplex.com/wikipage?title=AW2008Details

Note: EF 1.0 Compatibility Issues

The Entity Framework team would like us to let you know that AdventureWorks2008 is a little bit ahead of the curve in terms of the Katmai features it uses. Some datatypes in AdventureWorks2008 (such as hierarchyid and geometry) are not supported in the entity framework. The workaround is to exclude tables like Production.Document from your model if possible since there is currently no support for the hierarchyid datatype in Entity Framework 1.0. Unfortunately the Entity Framework tooling which updates your model from the database will pull in tables like Production.Document even if they were specifically excluded when the model was created, so use of that feature on AdventureWorks2008R2 is not supported at this time. We look forward to a follow-on release of Entity Framework which has full SQL Server 2008 type support. Last edited May 25, 2010 at 2:22 PM by bonniefe, version 17

like image 123
Shawn Avatar answered Oct 03 '22 07:10

Shawn