I am creating a MVC application using EF 6.0.0.0
and ODP.Net Oracle.ManagedDataAccess
version 4.121.2.0
for the data access.
I
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" />
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.