The Update Wizard in ADO.NET Entity Framework does not add tables.

.net ado.net entity-framework primary-key visual-studio-2008

Question

I entered my project using the new ADO.Net Entity Data Model was introduced and added tables to the model using the Refresh Wizard. The design surface now included five of the chosen tables. Two more tables won't add. The wizard asks me to choose them, and once I click Finish, they never appear on the design area.

Is this a glitch, or is it sometimes impossible to add a table to the model (by design)?


UPDATE: The issue is shown in the XML (*.edmx).

<!--Errors Found During Generation:
warning 6013: The table/view 'FooBar.dbo.Roles' does not 
have a primary key defined and no valid primary key could be inferred. 
This table/view has been excluded. To use the entity you will need to 
review your schema, add the correct keys and uncomment it.-->
<!--<EntityType Name="Roles">
    <Property Name="role_id" Type="decimal" />
    <Property Name="role_desc" Type="nvarchar" MaxLength="30" />
</EntityType>-->
1
92
8/31/2019 4:50:59 AM

Accepted Answer

The entity model is distinct from the design surface. A table in your EDMX mapping that does not show up on the design surface is feasible. To check whether this is the case, open the file as XML. Since the tables are already a part of the entity model in this situation, the Update Wizard will not let you add them again. In general, the Update Wizard is more knowledgeable about your entity model than it is about the design surface.

Although I don't believe it really describes your scenario, it should give you a broad notion of how to proceed: seek for references to the relevant tables in the XML.

46
2/13/2009 2:16:33 PM

Popular Answer

Set Primary Keys to all tables or leave only one column's "Allow null" checkbox unchecked in each table. It functions for me:



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow