Long question about connections, threads, etc.

Posts   
 
    
kingalef
User
Posts: 14
Joined: 10-Jul-2008
# Posted on: 06-Feb-2009 18:58:24   

Hi again, the system I am developing is a little "unusual". What I mean with that is that there isn't just one database I connect to, but several. By "several: I mean potentially hundreds. Let's say that my company's database is called OracleA and there are other vendors, whose database has a completely different schema. Let's call these MSSQL_X and MSSQL_Y (they don't have the same schema either). In an installation of our system we might have to connect to 10 OracleA DBs, 25 MSSQL_X and 10 MSSQL_Y.

Given this scenario, I'd generate 3 LLBLGen assemblies. What is the best way to use these assemblies in a multi-threaded/multi connection situation?

For instance, DbUtils.ActualConnectionString lets me specify the connection string to one of the 10 instances of OracleA. How do I change that while multiple threads can potentially try to access different instances of OracleA?

Specifically, thread 1 might need to connect to OracleA@PC1, thread 2 to OracleA@PC2, thread 3 to MSSQL_X@PC3 and so on. I obviously cannot serielize the requests of the first 2 threads, but if DbUtils is the kind of singleton I take it to be, there doesn't seem to be an alternative...

Bear with me if the question is silly, but I need to know the implications of working in a multithreaded/multiconnection scenario like this.

Best regards, Alessandro

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Feb-2009 04:06:55   

Hi Alessandro.

Actually the answer is easy: for that scenario the best approach is go on the Adapter TemplateSet.

David Elizondo | LLBLGen Support Team
kingalef
User
Posts: 14
Joined: 10-Jul-2008
# Posted on: 07-Feb-2009 15:47:48   

No way to do this with SelfServicing? I prefer that model as it is a bit more intuitive...

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 07-Feb-2009 20:09:00   

kingalef wrote:

No way to do this with SelfServicing? I prefer that model as it is a bit more intuitive...

Hey Alef, small world, isn't it? I'd suggest you to take the adapter path as well.

kingalef
User
Posts: 14
Joined: 10-Jul-2008
# Posted on: 08-Feb-2009 03:27:08   

Sure is a small world Miha simple_smile I thought you said you didn't use LLBLGen simple_smile

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 08-Feb-2009 11:47:40   

kingalef wrote:

Sure is a small world Miha simple_smile I thought you said you didn't use LLBLGen simple_smile

On the contrary. I use it all the time.

kingalef
User
Posts: 14
Joined: 10-Jul-2008
# Posted on: 08-Feb-2009 17:29:17   

Great to know.