I am writing my project using Entity Framework 4.0 (Model first). At the beginning of the project, I faced with this problem: I am trying to insert the filled object in the
I ran into this today and had to regenerate my EF classes from the database.
After doing that, I found that EF added:
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }
to this"Id" field that used to be an Identity column in the SQL but was changed to be app-assigned.
I think if you don't have that attribute EF won't actually send the ID to the database ('convention over configuration')
0
İf you dont use code first or db first oracle dont create be sequnce You try it trigger with sequence
CREATE OR REPLACE TRIGGER
"a"."IHALEYOL"
before insert on "a"."IHALEYOL"
for each row
begin
select "a"."SQ_DIREK".nextval into :new."ID" from dual;
end;
seq:
create sequence SQ_YETKI
minvalue 1
maxvalue 9999999999999999999999999999
start with 221
increment by 1
cache 20;
I had created the table with int Id as PK, but had forgotten to set "Identity Specification" = True