I am using Oracle as the DB, VS2012, and EF 5.0. I know the table has a PK (Composite Key) and I create a view (create view v_table_name as select * from table_name). When i try to add the view to EF, it says there is not PK and makes the object read only.
I have tried adding a PK to the view but it tells me that the "table can have only on primary key" ( ALTER VIEW V_TABLE_NAME ADD CONSTRAINT V_V_TABLE_NAME_PK PRIMARY KEY (DRSY, DRRT, DRKY) DISABLE NOVALIDATE;)
EJLindsay
Member
298 Points
161 Posts
ASP.NET 4.0, EntityFramework and Views
May 02, 2010 11:13 AM|LINK
Cannot seem to find a good fit for my question so I will ask here.
Does Asp.Net 4.0 solve the problems with using Views with EntityFramework is not able to recognize primary keys.
Jay
ASP.NET 4.0 EntityFramework and Views
ignatandrei
All-Star
137716 Points
22159 Posts
Moderator
MVP
Re: ASP.NET 4.0, EntityFramework and Views
May 02, 2010 01:22 PM|LINK
EF now is recognizing Foreign Key
Could you give an exampe where you encountered
?EJLindsay
Member
298 Points
161 Posts
Re: ASP.NET 4.0, EntityFramework and Views
May 02, 2010 08:22 PM|LINK
I have not installed VS 2010 yet. I was just asking the question to see if VS 2010 will solve me problem with views.
Jay
pwensel
Member
4 Points
2 Posts
Re: ASP.NET 4.0, EntityFramework and Views
Dec 19, 2012 02:12 PM|LINK
I am using Oracle as the DB, VS2012, and EF 5.0. I know the table has a PK (Composite Key) and I create a view (create view v_table_name as select * from table_name). When i try to add the view to EF, it says there is not PK and makes the object read only. I have tried adding a PK to the view but it tells me that the "table can have only on primary key" ( ALTER VIEW V_TABLE_NAME ADD CONSTRAINT V_V_TABLE_NAME_PK PRIMARY KEY (DRSY, DRRT, DRKY) DISABLE NOVALIDATE;)
Any idea why EF is not recognizing the PK