Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EF beta - views with no primary key

Paul NewmanJul 17 2011 — edited Oct 25 2012
When importing views into the entity framework designer, it often gives this error (in the edmx file only; no error is shown in the UI):

warning 6013: The table/view '[view name]' 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.

I don't want to cloud the issue by going into the details of the views in question; there will always be views where no PK can be inferred automatically, for many reasons. And I am quite happy to define the key fields myself after import. The problem is that it can't be imported at all. So my question to the ODP.NET developers is: can you just import it, and leave me to define the PK?

The workaround I am using is:
1) define a temp table of the same structure
2) temporarily recreate the view as "select * from [temp table]"
3) update the model from database
3) recreate the proper view

But it's a pain. I have to remember to do that every time I update the model from the database. If I forget, it wipes the mapping, and I have to redefine it manually, field by field.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2012
Added on Jul 17 2011
15 comments
11,517 views