Multiple DB support and personalization ao DataAccessAdapter

Posts   
 
    
Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 09-Oct-2006 12:42:45   

Our developement setup: *) .Net 2.0, VisualStudio 2005 *) LLBLGenPro 2.0.0.0 Final (September 13th, 2006) *) Code generation: Adapter/VB.Net 2.0/Standard Templates *) LLBLGenPro Lib 2.0.0.60919

In our project we'll need to support 2 database, MSAccess and MS SQL Server. We will need to extend the standard DataAccessAdapter mainly because of some check that we'll do overriding some of the adaptrer.On... method (OnFetchEntity/OnSaveEntity/...)

The problem is that supporting 2 different RDBMS mean have 2 independent DBSpecific project. These 2 independent DBSpecific project need to share the same personalization of DataAccessAdapter class.

The only pratical solution that I can see is to create the first personalized DAA in MSAssess dbspecific project, and then copy/paste our MyDataAccessAdapter.vb in the SQLServer DBSpecific project. But I will need to remember to copy/paste again this file after each update to our DAA personalization disappointed

Any better Idea?

Will ever LLBLGen have integrated support for multiple RDBMS? If LLBLGen was able to generare a single DBSpecific project supporting multiple RDBMS, I can think to some template like CommonBaseClass for DataAccessAdapter. A similar approach can nicely solve the problem. sunglasses

Thanks, Max

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 09-Oct-2006 16:21:50   

Hi,

I reckon DBSpecific can't really be expected to support multiple RDBMS, as its name states, since it is modelled as the one component that differs.

Now, coming back to your issue, if you can afford to make your changes in a class inheriting from dataaccessadapterbase which in turn you inherit with your concrete adapters, that should be much less code to maintain.

Now, have you considered using entity validators? They may fit your needs. You may also have a class inheriting from entitybase(2) which overrides its on... methods.

cheers

Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 09-Oct-2006 17:28:14   

Jessynoo wrote:

Hi,

I reckon DBSpecific can't really be expected to support multiple RDBMS, as its name states, since it is modelled as the one component that differs.

Sure, but If my project need to support multiple RDBMS, this mean that the db schema over the different RDBMS are identical. It's true that even with the same schema, different RDBMS will use differend data type, so LLBLGen need to generate different persistenfeInfo object.

But, imagine.... in theory i believe it's possible to extend LLBLGen so I can do something like: *) Tell to LLBLGen that I'm going to do a multi-RDBMS project *) Tell to LLBLGen which is the "Master" RDBMS, LLBLGen will use this DB to get schema info *) Tell to LLBLGen which are the others RDBMS that I'll need to use

Now, LLBLGen can internally use the ProjectConverter to convert the schema info from Master RDBMS into the schema info of the other RDBMS supported by my project. Now LLBLGen can generare a single VS project that contain a single DataAccessAdapter, that will rely on different groups of PersistenceInfo Object, one for each supported RDBMS. And I can config somewhere the RDMBS tha I want to use.

In a smilar situation I can extend the single DataAccessAdapter generated Class, and benefit of that over every supported RDBMS.

I will benefit of a similar solution even in other situation: for example, now, I'm building a dataAdapterFactory class that will give me the right data access adapter (Access or SQL Server). I need that because I have 2 different DataAccessAdapter in 2 different DLL/namespace.

Jessynoo wrote:

Now, coming back to your issue, if you can afford to make your changes in a class inheriting from dataaccessadapterbase which in turn you inherit with your concrete adapters, that should be much less code to maintain.

I'm thinking about this approach. This solution involve the creation of another project. Inside that project I will define my CommonDataAdapterClass. I must reference this project, that contain only one class, in all my DBSpecific projects. I need to change the template, so that the generated DAA will inherits from my CommonDataAdapterClass.

I didn't like the idea of creating a new project that will hold only one class... but maybe it's better than copy/paste the class over multiple project simple_smile

But it may get complicated for the template modification. My final Project will work with 4 different DB: DataDB, ConfigDB, AuditingDB, DocumentsDB (All access, or all SQL Server). So I will need 4 different template modification... or it's possilbe to parametrize the template with some user input asked during (or just before) the generation? Sorry, but I never tried modify a template.

Jessynoo wrote:

Now, have you considered using entity validators? They may fit your needs. You may also have a class inheriting from entitybase(2) which overrides its on... methods. cheers

I need to do auditing about changed/inserted/deleted entity. IMHO adapter it's the right place for that.

Thanks, Max