Table Does Not Exist while using EF 6 and Oracle.ManagedDataAccess Table Does Not Exist while using EF 6 and Oracle.ManagedDataAccess oracle oracle

Table Does Not Exist while using EF 6 and Oracle.ManagedDataAccess


The problem why the Data Table was not found, as suggested by DevilSuichiro in the comment, was due to the wrong Schema used. By default, EF 6 use dbo as default schema while my schema is not dbo. To make the model having default schema, an overriding for OnModelCreating event is needed:

public class EmployeeContext : DbContext {    public DbSet<Employee> Employees { get; set; }    protected override void OnModelCreating(DbModelBuilder modelBuilder) {        modelBuilder.HasDefaultSchema("myschema");    }}

Also, thanks to Ivan Stoev for his suggestion to check the SQL generated by the EF.


We had the same problem.What we found was a reference to the wrong database schema in the edmx file:

<EntitySet Name="MyTable" EntityType="Self.MyTable" Schema="**wrongSchemaName**" store:Type="Tables" />

By deleting the schema name our issue was resolved.

<EntitySet Name="MyTable" EntityType="Self.MyTable" Schema="" store:Type="Tables" />