Hello,
I am experimenting with the beta 3 of Entity Framework provider (released yesterday 02.04) and noticed several issues related to Oracle 11.2 support. I am using .NET Core 2.2 on Windows 10, Oracle 11.2 on Linux
- When scaffolding an existing database with a command like:
Scaffold-DbContext "User Id=******;Password=********;Data Source=********;" Oracle.EntityFrameworkCore -context MyContext
the scaffold does not succeed because it tries to execute:
SELECT sys_context('userenv', 'current_schema') as schema, c.table_name, c.column_name, c.column_id, c.data_type, c.char_length, c.data_length, c.data_precision, c.data_scale, c.nullable, c.data_default, c.virtual_column, c.hidden_column, c.user_generated FROM user_tab_cols c INNER JOIN user_tables t ON t.table_name=c.table_name WHERE t.table_name <> '__EFMigrationsHistory' ORDER BY c.column_id
which emits (0x80004005): ORA-00904: "C"."USER_GENERATED": invalid identifier,
because this particular column was introduced in user_tab_cols in Oracle 12c.
Is there a switch to use Oracle 11.2 when scaffolding?
- second problem (after I used a workaround to bypass the first problem) is with an identity column which have a trigger and sequence to increment server side.
I have added , b => b.UseOracleSQLCompatibility("11") in optionsBuilder.UseOracle(...) as suggested in the documentation
When I add an entity to context and then execute context.SaveChanges() it fails every time with a .NET Exception (ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.) no matter whether I added entity.Property(e => e.Id).UseOracleIdentityColumn() or not.
The only way it works properly is if I add entity.Property(e => e.Id).ValueGeneratedNever(); in OnModelCreating(...) in the generated context
However in this case the Id of the property is not populated afterwards.
Most probably both of my problems are connected with the fact that I use Oracle 11.2, but according to the documentation this should be a supported scenario. May be I am missing something obvious here.
P.S: When using beta 2 of the Oracle EF Core provider first problem didn't happen, only the second one
Best regards,
Plamen