views:

23

answers:

1

Whilst going through the "ADO.Net Entity Data Model" wizard, I select 3 tables from within a Database to add to my edmx file, and when the file is generated only one of the three tables is there. There was no error or warning to explain why the other tables haven't been added. If I try and add one of the failing tables on its own, again, nothing happens. I am using VS 2010, SQL Server 2008.

Any ideas as to why these database tables are failing to create? I realise there isn't much detail to this question, but there isn't much detail to the situation - It really is a database with 3 tables, of which 2 are failing to create through the wizard with no error.

Thanks.

+2  A: 

It could be that the 2 tables that are failing do not have an index.

Also, if you open up the edmx file in notepad (or other text reader), the error message is proably in there.

Shiraz Bhaiji
I don't think not having an index is a reason for EF to not include them, they're always included. Sometimes however they're included as a read-only object, for example when the primary key is missing. Good point on opening the edmx file
Sander Rijken
You are slightly mixing up the terminology - you mean (primary)key instead of index. But this is unlikely the cause because the Entity Framework can handle tables and views without keys. Up to .NET 3.5 SP1 the entity key is just inferred as composite key containing all non-nullable columns. I am not sure if something changed in .NET 4.0. Inferring the entity key may still fail if all columns are nullable. In this case there will be a error message in the XML, so +1 for looking into the EDMX.
Daniel Brückner