Cannot insert row with RAW(16) Primary Key mapped to GUID in Oracle Entity Framework Core 8

61 Views Asked by At

I have an Oracle 21c database, using Entity Framework Core 8, and Oracle.EntityFrameworkCore 8.21.121.

I have a table FWROLE with the Primary Key Column Id RAW(16) and a Model with that column mapped to a Guid Property.

When I try to insert a record into this table, I get an exception with the message "ORA-06550: line 5, column 6: PLS-00215: String length constraints must be in range (1 .. 32767)" I used a DbCommandInterceptor to get the Query that is being sent to the database, and this exception is pointing to the Type that is being generated to return the Primary Key value back to Entity Framework.

  ... // omitted for brevity
  TYPE "rFWROLE_0" IS RECORD
  (
    "ID" RAW
    ,"ISINACTIVE" NUMBER(1,0)
    ,"LOCKVERSION" NUMBER(9,0)
  );
  ... // omitted for brevity

When I run this query in Oracle Sql Developer, I get the same error message; changing the query to contain the length of the RAW column fixes the issue; is there a way to get Oracle.EntityFrameworkCore to generate the query to correctly appear as

  ... // omitted for brevity
  TYPE "rFWROLE_0" IS RECORD
  (
    "ID" RAW(16)
    ,"ISINACTIVE" NUMBER(1,0)
    ,"LOCKVERSION" NUMBER(9,0)
  );
  ... // omitted for brevity

As a temporary workaround, I added a Regex in the DbCommandInterceptor that replaces the "ID" RAW with "ID" RAW(16), but that's not something I want to leave in the code base.

0

There are 0 best solutions below