sqloracle-databaseentity-frameworkef-model-first

How to add a primary key to a View - Oracle


I have a View in an Oracle database. I want to use this view in my ASP.NET MVC project. I know that in order to add that view to EF, that view needs to have a primary key. I don't know how to add a primary key as a new column to that view. None of the columns in the view is unique. How can I add that? Thanks.


Solution

  • Building on Ivan's comment, you could build your view like this:

    SELECT rownum, *
      FROM (your_current_view_query)