global connection string

Posts   
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 09-Apr-2007 17:51:21   

I'm working on a huge accounting app. There are about 20 llbl gened projects in it for various sections of functionality. payroll has one, fund ledger, ap, ar etc etc.

Right now, our clients might not buy all sections. Is there a way to set the connection strings for each project on the fly as they get used? I can't use a config file since they point to the db they want to when the app starts up. Right now I am setting the connection string property of each dbutil class in each dll when they change dbs. This requires me to have a reference and instantiate every single llbl gened dll whether they have bought it or use it. Is there a way to globally set something that they all look at if the user opens a module that uses one of them? I'd like to remove the referece to them from my main project.

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Apr-2007 04:36:42   

Please read these posts: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6567 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8276

BTW, what DB are you using and what TemplateSet (Adapter or SelfServicing)?

What about create a global variable that store the user selection, and then use that variable to supply the connectionString to all your DataAccessAdapter instances?

David Elizondo | LLBLGen Support Team
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 10-Apr-2007 13:44:19   

using ss.

the posts didn't help. I know how to set the connection string, i just need to do that to only some of the dll's or have them all pull it when they get used etc. I want to avoid instantiating them when I don't need them Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 10-Apr-2007 15:23:02   

The DbUtils.ActualConnectionString static member is static for a single set of generated classes, i.e. the project it is in. So if you have 10 selfservicing projects, they all have their own DbUtils class so you can set their connection string individually at application startup.

There's no 'more globally' way. So I'm afraid you have to do some assembly traversal at application startup (though you have to do that anyway to see which modules are present, IMHO) and store the assembly references somewhere. Then when the user switches db, set the actualconnectionstring property in the dbutils classes of the assemblies known. There's no other way, I'm afraid.

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 10-Apr-2007 15:24:55   

Otis wrote:

The DbUtils.ActualConnectionString static member is static for a single set of generated classes, i.e. the project it is in. So if you have 10 selfservicing projects, they all have their own DbUtils class so you can set their connection string individually at application startup.

There's no 'more globally' way. So I'm afraid you have to do some assembly traversal at application startup (though you have to do that anyway to see which modules are present, IMHO) and store the assembly references somewhere. Then when the user switches db, set the actualconnectionstring property in the dbutils classes of the assemblies known. There's no other way, I'm afraid.

ok thanks. that's what I figured I'd have to do. i just hoped there was an easier way. The usage isn't a 1 to 1, so a human is going to have to keep it up and make sure it's right.