The table/view does not have a primary key defined and no valid primary key could be inferred. RRS feed

  • Question

  • when trying to add an oracle view to the .edmx file (ADO.NET Entity Data Model), i get the above error in edmx XML.

    this question has been asked by numerous people, and the solutions provided are working for them, but unfortunately not in my case. i don't have control over the schema, and cannot add a non-nullable column or primary key. and if i manually try to edit the XML, it gets overwritten if i want to add some other view. so what is the solution?

    • Moved by VMazur Friday, July 22, 2011 10:31 AM (From:ADO.NET Managed Providers)
    Monday, July 11, 2011 10:28 PM

All replies

  • Hi Great,


    Welcome to the forum.

    The objectContext need a flag to track the Entity's state so that the tables or the views need a primary key.

    The StorageModels will update when you update the model. I support you could communicate with the DBA or you could only

    add the lose primary key view at last.


    Hope that would be help you.

    David Peng [MSFT]
    MSDN Community Support | Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 13, 2011 8:39 AM
  • David, thanks. For now I'm using Linked Server in SQL Server to get data from Oracle to local SQL Server. Then I can do the same drag drop and play thing. Just that I will use DataContext instead of EntityContext. In this case data is not required to be real time since it doesn't change that often.
    Wednesday, July 20, 2011 1:06 PM