I am using
Visual Studio: 17.14.10
Oracle Deveoper Tools for Visual Studio 2022: 23.8.2.0)
EF Core Power Tools: 2.6.1031
Microsoft.EntityFrameworkCore: 8.0.18
Microsoft.EntityFrameworkCore.Tools: 8.0.18
Oracle.EntityFrameworkCore: 8.23.90
When trying to get the tables in a DB first context (generating the scaffolding) it takes 16 minutes to run the query to get the table schemas.
Here is the query being run:
SELECT u.*,
v.trigger_name,
v.table_name,
v.column_name,
v.table_owner
FROM (SELECT c.owner 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.identity_column,
c.collation,
c.data_default,
c.virtual_column,
c.hidden_column
FROM all_tab_cols c
INNER JOIN
(SELECT DISTINCT object_name AS table_name, owner
FROM all_objects
WHERE object_type IN ('TABLE', 'VIEW', 'MATERIALIZED VIEW'))
t
ON t.table_name = c.table_name AND t.owner = c.owner
WHERE t.table_name <> '__EFMigrationsHistory'
AND (t.owner IN ( :s0, :s1))) u
LEFT JOIN ALL_TRIGGER_COLS v
ON u.table_name = v.table_name
AND u.column_name = v.column_name
AND u.schema = v.table_owner
ORDER BY u.column_id;
s0 = 'EFMD'
s1 = 'SDEADMIN'
If I run with only 1 schema (doesn't matter which) it is fast (less than 30 seconds).
Talking with the EFCorePowerTools guys they are using Oracle.EntityFrameworkCore: 8.23.90 internally.
I got their code and at this line is where it is slow…
databaseModel = this.databaseModelFactory!.Create(connectionString, dbModelOptions);
databaseModelFactory is an Oracle.EntityFrameworkCore.Scaffolding.Internal.OracleDatabaseModelFactory instance.
connectionString: USER ID=removed;PASSWORD=removed;DATA SOURCE=sdemod.world;TNS_ADMIN=X:\Apps\oracle\client\network\admin
Note, it is also slow if I use a basic connection instead of TNS.
dbModelOptions: schemas = an IEnumerable with ‘EFMD’ and ‘SDEADMIN’, tables = empty IEnumerable