Hi
when I generate an entity data model from my database all works fine except that my view is ignored. The generated .edmx file contains the following error message:
"The table/view 'xyz' 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."
My view contains a primary key of a table that can be used as primary key of the view objects. But maybe because of some outer joins and a distinct command this is not clear to the entity model generator.
How can I solve this problem? Manually editing the .edmx file is no solution because this changes always get lost if a create the model again.
database view ignored in entity data model
You have described a number of known EDM Designer problems.
I recommend you to add a Devart Entity model to your project. It is viewed and edited in its own editor - Entity Developer (fully integrated in Visual Studio).
Devart Entity model has the same functionality that the Microsoft models have, but its designer is more convenient.
For example, both problems you mention are solved in Entity Developer.
I recommend you to add a Devart Entity model to your project. It is viewed and edited in its own editor - Entity Developer (fully integrated in Visual Studio).
Devart Entity model has the same functionality that the Microsoft models have, but its designer is more convenient.
For example, both problems you mention are solved in Entity Developer.
Hi AndreyR,
many thanks for your fast response. I tried the Entity Developer and it works much better than the built-in model generator. The view entity is now generated. After generation I opened the class editor for the view entity in the diagram. All properties are generated as entity keys. That's strange but no problem as long I can edit the properties. So I cleared all keys flags of the properties except the one real key and set the nullable flag of some properties. Now I get the following error:
"Problem in mapping fragments starting at line 264:All the key properties (...) of the EntitySet xyz must be mapped to all the key properties (...) of table xyz.
How can I solve this problem?
many thanks for your fast response. I tried the Entity Developer and it works much better than the built-in model generator. The view entity is now generated. After generation I opened the class editor for the view entity in the diagram. All properties are generated as entity keys. That's strange but no problem as long I can edit the properties. So I cleared all keys flags of the properties except the one real key and set the nullable flag of some properties. Now I get the following error:
"Problem in mapping fragments starting at line 264:All the key properties (...) of the EntitySet xyz must be mapped to all the key properties (...) of table xyz.
How can I solve this problem?