Entity Framework Ignore Schema Entity Framework Ignore Schema oracle oracle

Entity Framework Ignore Schema


FrankO's answer is correct in that you can specify the default schema using the Fluent API.

In addition, this same method, in my experience, can be utilized to remove the default schema, allowing Oracle to resolve the schema in the case that it is specified on the connect string or if your companies policy is to access all tables through a public synonym.

protected override void OnModelCreating(DbModelBuilder modelBuilder){    modelBuilder.HasDefaultSchema(string.Empty);}

This would produce SQL containing FROM "MY_TABLE" instead of FROM "dbo"."MY_TABLE"

I'm using:

  • EntityFramework 6.1.3
  • Oracle.ManagedDataAccess 12.1.2400
  • Oracle.ManagedDataAccess.EntityFramework 12.1.2400


You could use Fluent API to declare the default schema like the following:

protected override void OnModelCreating(DbModelBuilder modelBuilder){    modelBuilder.HasDefaultSchema("your_schema_here");}