I have a problem using Entity Framework with oracle views, or views in general. I can easily retrieve data from the views through my Entity, which has views only and no tables, but I can't insert, update, or delete any records. This gives the below error below:
The table/view does not have a primary key defined. The Entity is read-only
This occurs even though all my views have at least one Field having "Entity Key" checked.
Note: I am using VS2013 and EF 6
Your view needs to be updateable (no joins possible) and must have definded primary key (for entity framework, constraint can be disabled, like shown below).
Example:
CREATE OR REPLACE VIEW MYVIEW (
ID,
<COLUMNS>,
CONSTRAINT UNIQUENAMEFORPKCONSTRAINT PRIMARY KEY (<PK_COLUMN>) DISABLE )
AS
SELECT <COLUMNS> FROM <TABLE> WHERE <CONDITIONS>;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With