Catalog Name in PersistenceInfoProvider

Posts   
 
    
Posts: 4
Joined: 08-Mar-2007
# Posted on: 09-Mar-2007 16:20:17   

Current release of llblGen Pro; .NET 2.0; VS2005; SelfServicing 2 Classes; C#; SQL Server

My application serves multiple divisions. Each division has it's own database. Each division database has a different catalog name. Administrators use the application to log into any one division database at a time and will change from one division to another throughout the day. The connection strings for the division databases are read from a seperate "security" database at login and passed to the application. For this reason I can't override the catalog name in the generated code by using an app.config setting.

At first I thought this was going to make LLBLGen unusable for this project. I have discovered that if I replace all occurances of the catalog name with a null string in the generate code everything works just fine.

Example: base.AddElementMapping( "CustomerEntity", "Testing", @"dbo", "Customer", 6 ); becomes base.AddElementMapping( "CustomerEntity", "", @"dbo", "Customer", 6 );

Is there any danger in doing this? Is there a better way? I wish there was a way to do the override from code like there is with the connection string.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 09-Mar-2007 22:45:04   

You can overwrite all catalog names to "" as well. This gives you the freedom to determine which db via the connection string.

Though, it would have been a better choice perhaps to use adapter in this case.

Frans Bouma | Lead developer LLBLGen Pro