How to Change Default Schema

Posts   
 
    
eirizarry
User
Posts: 48
Joined: 30-Mar-2011
# Posted on: 29-Apr-2011 17:56:29   

I have the situation in Oracle that when the code is generated the schema used to create the code in hardcoded in in the generated code. for example a call to a procedue "INSERT_PAEMP" is generated in the code as "USER"."INSERT_PAEMP". This give me an error is i try to run the application in another schema.

Using the SchemaOverwrite in the app.config does not work because we have multiple schemas on the same database and can be more than a 100 computers intallations.

any idea for a work around?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Apr-2011 20:54:12   

Use CatalogNameOverwrite with an empty string, then the schema in the connection string is used. So you can pass connectionString to your DataAccessAdapterInstance, and there you go.

David Elizondo | LLBLGen Support Team
eirizarry
User
Posts: 48
Joined: 30-Mar-2011
# Posted on: 29-Apr-2011 21:50:56   

can you give me an example? I can not find the CatalogNameOverwrite

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Apr-2011 07:50:32   

You should use CatalogName Overwrites section in the config file, with an empty new catalog name.

eg.

<configSections>
    <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<sqlServerCatalogNameOverwrites>
    <add key="myDevCatalog" value="" />
</sqlServerCatalogNameOverwrites>

  • This will force the system to use the catalog name in the connection string.

  • And hence you may pass the connection string to the DataAccessAdapter CTor. (Which might differ based on the logged in user).

eg:

using (DataAccessAdapter adapter = new DataAccessAdapter(theConnectionStrWithUser1))
{
...
}
...
using (DataAccessAdapter adapter = new DataAccessAdapter(theConnectionStrWithUser2))
{
...
}
David Elizondo | LLBLGen Support Team