Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > General> Catalog Overwriting during Runtime?
 

Pages: 1
General
Catalog Overwriting during Runtime?
Page:1/1 

  Print all messages in this thread  
Poster Message
HaulMark
User



Location:

Joined on:
11-Aug-2004 02:44:45
Posted:
17 posts
# Posted on: 12-Apr-2008 04:38:16.  
I have a user requirement to allow Catalogs to be renamed but I'm not sure how to program this. I have read that the app.config file cannot be modified easily at runtime so is there another way to overwrite the LLBL Catalog name with the user defined name without modifying the app.config?
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
3970 posts
# Posted on: 12-Apr-2008 05:48:22.  
Are you using Adapter or SelfServicing? What database are you using?

For SelfServicing:
LLBLGenPro Help - Using the generated code - SelfServicing - DbUtils functionality

For Adapter:
LLBLGenPro Help - Using the generated code - Adapter - DataAccessAdapter functionality - Functionality - Catalog specific persistence info


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
HaulMark
User



Location:

Joined on:
11-Aug-2004 02:44:45
Posted:
17 posts
# Posted on: 13-Apr-2008 05:21:55.  
daelmo,

Thanks for the quick reply.

So if my LLBL was generated against a CATALOG called "DATABASE1" and the user installs the product and renames the CATALOG to "MYDATABASE", I can use the DBUtils.ActualConnectionstring to use the "MYDATABASE" and it will automatically overwrite the Catalog name similiar to "Catalog name overwriting" in "Generated code - Application configuration through .config files"?
  Top
HaulMark
User



Location:

Joined on:
11-Aug-2004 02:44:45
Posted:
17 posts
# Posted on: 13-Apr-2008 05:32:53.  
daelmo,

I tried using the DBUtils and it does not work as LLBL is still looking for the original Catalog Name. I guess I did not work my initial question properly - let me try again: Is there a way to overwrite the Catalog Name programatically instead of doing it in the app config. My customer requires the ability for them to change the DB name...

Thanks!


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
3970 posts
# Posted on: 13-Apr-2008 21:38:10.  
Hi HaulMark,

Ok. Here is what you should to do:

1. Configure Catalog name overwriting at config file, staying "" for the new catalog name. This says that the catalog name included at connectionString should be used.
Code:
<configSections>
    <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
</configSections>

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


2. Modify the DBUtils.ActualConnectionString (including the new catalog name) where appropriate somewhere in your code.
Code:
DbUtils.ActualConnectionString = "....initial catalog=NewCatalog;....";


Please let me know if you made it.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
rboarman
User



Location:
United States
Joined on:
01-Feb-2005 18:27:43
Posted:
60 posts
# Posted on: 07-May-2009 20:31:08.  
What version was this functionality introduced in? My company is still using 2.0.

The above fix is not working for me.

Thanks,

Rick


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
3970 posts
# Posted on: 08-May-2009 07:32:55.  
Hi Rick,

If you refer to the Catalog Name Overwriting functionality, AFAIK, this was introduced in v2.0. I quote the v2.0 manual ("Migrating your code" section):
Quote:
All persistence info now contains the catalog name as it is known in the project (if applicable, like with SqlServer). This is a change from v1.0.200x.y where the catalog name was only generated into the persistence info when 2 or more catalogs were in the project. Because the catalog name is in the persistence info, you can't simply switch catalogs by setting a connection string, if you need to connect to a different catalog at runtime then the one you used to create the project. To be able to do so, you need catalog name overwriting through the config file. Please see Generated code - Application configuration through .config files for more details on this.

So, if you are experimenting problems with this please open a new thread (to maintain order in the old threads) and provide the appropriate info (http://llblgen.com/tinyforum/Messages.aspx?ThreadID=7722) Wink

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Pages: 1  


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

Version: 2.1.12172008 Final.