How to change the schema through the connection string when connecting to Oracle using the Entity Framework?

When I generated the EDMX file, it set the schema for each EntitySet

<EntitySet Name="TableName" EntityType="Model.Store.TableName" store:Type="Tables" Schema="MySchema" /> 

The problem is that if I want to switch to the production database, I need to change EDMX, since I do not know how to select the schema in the connection string.

How to do it?

+7
source share
2 answers

If the first code method is an option, you can override the OnModelCreating method in your DbContext class. In the OnModelCreating method, you can put the logic to detect oracle and rename the circuit accordingly. The first code approach was given here .

+1
source

I just needed to edit EDMX and remove the schema from each EntitySet

 <EntitySet Name="TableName" EntityType="Model.Store.TableName" store:Type="Tables" /> 

Now it connects to the default scheme for this user.

+10
source

All Articles