Dynamic CatalogName change - SelfServing

Posts   
 
    
zoinky
User
Posts: 5
Joined: 03-Jul-2009
# Posted on: 03-Jul-2009 10:10:28   

I know this has been asked after reviewing the forum. I have not seen an answer from fran or anyone that knows if this is possible or not.

I have developed a application that generates other applications (databases, virtual directories etc) and I am in need of being able to set catalog name dynamically and execute transactions against the newly created db's using self serving (my dal is too big to convert to adapter).

I have to admit, not researching this is my own fault but I have been using llblgen for so long and never thougth i would run into something that was not possible.

It just seems unusual that there is no work around or hack for this, other than having to set it in web.config to change db names.

If anyone know how we can do this using runtime (since changing web.config is not possible at runtime) I would appreciate it.

Fran, can you let us know if u are even considering this or release a hot fix.

zoinky
User
Posts: 5
Joined: 03-Jul-2009
# Posted on: 03-Jul-2009 10:16:22   

could someone move this to generated code, put it in the wrong forum

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 03-Jul-2009 10:55:05   

This has been asked several times before in the forums. simple_smile

You will have to use Catalog name overwrites in the web.config to set the catalog name to an empty string.

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

Then dynamically set the connection string in code:

docs wrote:

Connection strings The DbUtils class lets you set the global connection string to use for every connection to the database. This setting overrides the connection string read from the appSettings section in the .config file. Once the setting is set, every connection to the database uses the set connection string. You set the connection string to use at runtime using the following code

:

DbUtils.ActualConnectionString = "Datasource=myserver;....";

The framework will use the ctalaog name defined in the connection string.

zoinky
User
Posts: 5
Joined: 03-Jul-2009
# Posted on: 03-Jul-2009 11:35:16   

i thought i had read all the threads about this and someone said it was impossible to do i didnt think it was impossible so i had ot ask to make sure simple_smile thanks and perfect. this will serve me right.