Should multiple databases share the same DAL?

Posts   
 
    
webbsk
User
Posts: 17
Joined: 24-Sep-2009
# Posted on: 29-Sep-2011 17:15:37   

We have applications that must reach into multiple databases. Previously, we had separate DALs that would reach into only a single database. A separate business layer would sit on top would reach only their particular DAL. Applications (different websites) that would sit on top the business layer were free to call any number of business layers if they needed to share the data.

This worked well for a while. However, nowadays, the solutions to build an application have become massive. The application layers all seem to every business layer. Reuse is happening, but the builds have slowed to a crawl and the amount of unnecessary code that is brought into a single solution seems unreasonable.

Has anyone else dealt with this situation? Did you bring the data sharing down to the DAL later using LLBLGen?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 30-Sep-2011 09:46:21   

Are you speaking about databases having exactly the same schema?

webbsk
User
Posts: 17
Joined: 24-Sep-2009
# Posted on: 20-Oct-2011 18:10:42   

No, the databases have completely different schemas and tables. They need to share the data and currently they are doing that entirely through code.

webbsk
User
Posts: 17
Joined: 24-Sep-2009
# Posted on: 20-Oct-2011 18:12:34   

Actually, there are also some very nasty triggers and Ruby code that sync data between databases. This is all to facilitate the fact that the data needs to be accessible to the code in a consistent fashion. I think that it makes the most sense to do this in a DAL, but I'm not entirely sure what the best practice is.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 21-Oct-2011 10:57:35   

If you are sharing data from different databases, then the question is why different schemas in the first place?

webbsk
User
Posts: 17
Joined: 24-Sep-2009
# Posted on: 21-Oct-2011 18:03:41   

It's legacy architecture that we're stuck with. One DBMS is the older system and it's SQL Server, the other is the newer system and it's PostgresDB. However, we have multiple applications that use both databases because they do have different information (and some shared).

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Oct-2011 20:02:00   

So I assume you have some single domain application like "Human Resources" which contains one whole unit of business logic, that's why so feel like you have to merge both DALs. Well, you can do that, you can add two catalogs from different Database engines in LLBLGen (i.e. SQLServer and PostgresDB).

David Elizondo | LLBLGen Support Team