sqlServerCatalogNameOverwrites and DbUtils.ActualConnectionString

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 23-Mar-2007 14:39:39   

Our Dev DB catalog is different than our Test and Production.

If we set the DbUtils.ActualConnectionString to specify the DEV/TEST/PROD catalog name, do we still need to use the **sqlServerCatalogNameOverwrites **to override the catalog name?

Ian

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Mar-2007 15:04:27   

LLBLGen Pro won't change the catalog / schema based on the connectionstring you're specifying. The connection string is used to connect to the database system, though persistence information in the generated code contains the catalog name(s) to target. If you want to modify the catalog to target with the code at runtime, please specify name overwriting settings.

ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 23-Mar-2007 15:23:51   

What if I specify a blank override, would that then use the connection string to get the catalog?

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueFileSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </configSections>

  <sqlServerCatalogNameOverwrites>
    <add key="TestName" value=""/>
  </sqlServerCatalogNameOverwrites>
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Mar-2007 15:30:51   

Nope, the catalog name is hard-coded into the persistence info of different object.

ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 23-Mar-2007 15:39:14   

I must have misunderstood the manual. What does this mean:

from: Generated code - Application configuration through .config files

You can also specify an empty string. In that case, the DQE will not specify a catalog name in the generated SQL elements, which will make the SQL target the catalog specified in the connection string.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 24-Mar-2007 00:16:18   

This will work for the overwrites using the connection string if. TestName is what you generated the code against.

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