Multiple database guidance - adapter vs. self-servicing

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 24-Dec-2004 23:11:32   

I checked out this thread

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=167

but that was before the latest release, so I'm not sure if it applies to me.

I have a SQL Server database and and an Access database (hey Frans, thanks for doing the Access driver!). The latter is a subset of the former, basically people are "checking out" some data, so the tables will be similar but not exactly the same. Some may be denormalized (because they are read-only). Certainly PKs in SQL Server with IDENTITY property will just be integers in Access.

At first I assumed that I would have to go with adapter scenario, because the manual suggests using adapter if you have multiple dbs. But why? Can I not just create two DALs, one for each database? What does the adapter scenario really buy me here? I like the self-servicing scenario, it seems so much more OOP to me (objects know how to persist themselves). I don't want my choice of ORM architecture to be driven solely by the fact I have a second database to deal with.

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 25-Dec-2004 18:22:29   

I just read the intro to the adapter model in the manual (I have been reading the manual straight through and actually just happened to get to it yesterday) and it appears to be talking about multiple database sources that actually have the same schema. So it seems to me this is the scenario where you have a product and you support different database servers but the schema are identical. My situation is I have two different database servers with different (though similar) schema, so in my case I think I would have to create two projects and generate two DALs regardless of which model I use. Does this seem right? And also I suppose I need to set the connection strings at runtime, since both DALs will be looking for the same entry in web.config.

(edit: corrected misspelling)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39752
Joined: 17-Aug-2003
# Posted on: 26-Dec-2004 11:22:22   

JimFoye wrote:

I just read the intro to the adapter model in the manual (I have been reading the manual straight through and actually just happened to get to it yesterday) and it appears to be talking about multiple database sources that actually have the same schema. So it seems to me this is the scenario where you have a product and you support different database servers but the schema are identical. My situation is I have two different database servers with different (though similar) schema, so in my case I think I would have to create two projects and generate two DALs regardless of which model I use. Does this seem right?

Totally correct simple_smile

And also I suppose I need to set the connection strings at runtime, since both DALs will be looking for the same entry in web.config. (edit: corrected misspelling)

No, you can specify the key for the connection string in the .config file in the project properties of the LLBLGen Pro project. For example name the connectionstring key something like catalogname.ConnectionString. You can then have multiple entries in teh appSettings tag in the .config file simple_smile

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Dec-2004 05:51:53   

Ah, great, Frans, thanks.