Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> sqlServerCatalogNameOverwrites at runtime
 

Pages: 1
Bugs & Issues
sqlServerCatalogNameOverwrites at runtime
Page:1/1 

  Print all messages in this thread  
Poster Message
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 22-Apr-2008 17:30:44.  
Is there a way to do the following at runtime?

<sqlServerCatalogNameOverwrites>
    <add key="WeldQA" value="WeldQADev" />
</sqlServerCatalogNameOverwrites>

Having this in the app.config file is not ideal as the Catalog Name of the database is dependant on the command line argument passed in. As an example to tell the program to use the production, development, or testing version of the database.

Thanks!
  Top
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 22-Apr-2008 17:39:47.  
More info....

LLBLGen Pro 2.5 and the gen. project is Self Serve.

I was also reading a post:

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8785

Where a poster had mentioned:

"I have set the "value=" part in the "sqlServerCatalogNameOverwrites" section to an empty string; now I can switch to any other sqlserver database at runtime by changing the catalog name in the connectionstring.
My problem is solved, sorry for the inconvenience. "

Is this a best practice to solve this problem? Essentially I am having to specify the sqlServerCatalogNameOverwrites key to equal the name of the Catalog in the connection string anyway.

What's the advantage of having the catalog name tightly bound in with the columns and other code in the generated classes? Is there a reason for this that I am missing? In any other .NET project I've written, changing the connection string does not require changing the catalog names anywhere else in your code.

Thoughts?


  Top
goose
User



Location:
Central America
Joined on:
06-Aug-2007 18:21:05
Posted:
392 posts
# Posted on: 22-Apr-2008 19:03:17.  
That's is the best practice to do what you are trying to do (changing the catalog name at runtime).
The catalog name is used in the generated code for write the queries against DB:
SELECT * FROM [SCHEMA/OWNER].[CATALOG_NAME].[TABLE_TAME]....
gansodesoya  Top
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 22-Apr-2008 19:10:59.  
So you mean just setting the value in the config file to "" and assigning the ConnectionString at run time?

What advantage does having the InitialCatalog name hard coded in the ORM generated files was my other question... Any idea?

Select * from tblMyTable works the same as Select * from myCatalog.tblMyTable

I'm going to assume that this is for those cases where your ORM project has more than one catalog?


  Top
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 22-Apr-2008 19:11:19.  
So you mean just setting the value in the config file to "" and assigning the ConnectionString at run time?

What advantage does having the InitialCatalog name hard coded in the ORM generated files was my other question... Any idea?

Select * from tblMyTable works the same as Select * from myCatalog.tblMyTable

I'm going to assume that this is for those cases where your ORM project has more than one catalog it uses within the same project?
  Top
goose
User



Location:
Central America
Joined on:
06-Aug-2007 18:21:05
Posted:
392 posts
# Posted on: 22-Apr-2008 19:39:31.  
Quote:
So you mean just setting the value in the config file to "" and assigning the ConnectionString at run time?

If you are using SelfServicing you could use DBUtils.ActualConnectionString at runtime (http://llblgen.com/TinyForum/Messages.aspx?ThreadID=13082)

Quote:
What advantage does having the InitialCatalog name hard coded in the ORM generated files was my other question... Any idea?

It's best practice to write SQL statements using Fully Qualified Names as it gains performance.


gansodesoya  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.