database view ignored in entity data model

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
AnyDev
Posts: 6
Joined: Thu 27 Jan 2011 08:48

database view ignored in entity data model

Post by AnyDev » Fri 11 Feb 2011 07:29

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 11 Feb 2011 10:13

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.

AnyDev
Posts: 6
Joined: Thu 27 Jan 2011 08:48

Post by AnyDev » Tue 15 Feb 2011 09:58

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 15 Feb 2011 12:18

Go to Model Explorer->Model.Store, and change the key for the Store view representation.
Entity Developer provides the possibility to edit the Storage part of the model.

AnyDev
Posts: 6
Joined: Thu 27 Jan 2011 08:48

Post by AnyDev » Tue 15 Feb 2011 12:49

That solved it! Thanks a lot for your fast support and many thanks to the Devart Team for this great software!

Post Reply