EF Core use Oracle ROWID as primary key

Viewed 224

I have an Oracle table that has no primary key (and no, I cannot change the schema). I've been able to implement CRUD operations on it other than Create by using rowid as a primary key:

//Inside OnModelCreating, modelBuilder.Entity<Foo>()
eb.Property(foo => foo.Rowid)
    .HasColumnType("ROWID")
    .ValueGeneratedOnAdd();
eb.HasKey(foo => foo.Rowid);

But I get an Oracle error when I try to insert a new record, even though I have indicated that the rowid column shouldn't have a generated value. The SQL looks like this where p0 is a GUID:

BEGIN

INSERT INTO "FOOS" ("ROWID", ...)
VALUES (:p0, ...);
END;

How can I configure EF Core to skip the column when inserting?

0 Answers
Related