Swapping Connection Strings at Runtime...

Posts   
 
    
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 12-Aug-2005 18:26:49   

Frans,

I was thinking of different ways to introduce an deployment architecture change in my application... I'm looking at ways to increase the performance of my DB and had an idea to replicate the DB out to a farm of readonly database servers.

The idea is to have a single master database for Insert/Update/Delete and transactional Selects. The data is then replicated in real time out to a bunch of other servers which can handle non transactional Selects.

The obvious place to do this is in the Data Access Layer (LLBLGen) smile

I was thinking that I could maybe make the changes in my extended DataAccessAdapter and hook into the OnFetchEntity, OnFetchEntityCollection events to swap the connection string just prior to retrievals where IsTransactionInProgress = false.

Do you think this would work?

Marcus

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 12-Aug-2005 20:38:13   

Yes, that's no problem. As soon as OpenConnection() is called, changing the connectionstring property has no effect, but before that, you can change it to have it take effect in the next persistence call. As dataaccessadapters aren't shared among threads, you should be able to do this simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 12-Aug-2005 21:12:27   

Otis wrote:

Yes, that's no problem. As soon as OpenConnection() is called, changing the connectionstring property has no effect, but before that, you can change it to have it take effect in the next persistence call. As dataaccessadapters aren't shared among threads, you should be able to do this simple_smile

Great! smile