我在项目中添加了一个新的ADO.Net实体数据模型,并使用更新向导将表格添加到该模型中。其中五个选定的表格被添加到了设计图面上,但另外两个表格无法添加。我在向导中选择它们,然后点击"完成",但它们从未显示在设计图面上。
这是一个错误吗?还是有一些情况下某些表格不能被添加到模型中(出于设计考虑)?
更新: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>-->