Multiple Databases

Posts   
 
    
Sean_22
User
Posts: 5
Joined: 15-Mar-2005
# Posted on: 15-Mar-2005 22:59:22   

I am attempting to create an app that will allow multiple (identical) databases to essentially "sync" up and, at the end of every day, update each other so as to make a few of their tables contain identical data (example: I add a user to my database at location 1 and would like, by the next day, for that user to also exist in the database at location 2).

I have gotten the "ActualConnectionString" thing handled, and switching connections between multiple databases in the middle of my app handled, so as long as the databases i am "syncing" remain identical, I'm fine. My problem arises if the software at one of my sites is updated, and said update includes the addition of a new field to a table (and thus an upated version of my LLBLGEN dll), and the other site is NOT updated before this "sync" is run. Obviously, since the LLBLGEN will not contain the same fields for the table that was affected by the update, it will likely blow its brains out when I try to create any new entities on it.

Long story longer, my question is; if I have a distinct subset of fields I NEED "synced" between the various databases, and this subset will NOT change in any updates, is there any way to generate a secondary LLBLGEN dll (that I would reference in my syncing application) that I would NEVER change and would only contain definitions for a subset of my tables and, further more, a subset of FIELDS within those tables? (continuing example from above: I add a field to my Users table but, because it isnt included in this secondary LLBLGEN dll, which is the dll my syncing application uses, LLBLGEN will NOT blow up if one site has receieved the aforementioned updated and the other has not)

Sorry if thats longwinded and complicated, basically I just want to know if I can generate my LLBLGEN dll in such a way as to have it only include certain fields in any given table, OR, if there is a way to have LLBLGEN not blow up if new fields are added to a table AFTER the dll generation process has been run.

Thanks in advance, Sean

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 16-Mar-2005 10:48:54   

It selects the fields for an entity as defined when you generate the code. So if you add a field to the database after that, that field isn't loaded nor saved, until you refresh the catalog and re-generate the code. So if you keep that generated code assembly separated from your other project (you can use more generated code assemblies in your project, just give them different root namespaces), and update that one, you'll be fine.

Though it can become a maintenance issue later on. For the functionality you want to perform, I'd like to point out (if you're using sqlserver, but oracle and db2 for example have similar features (more advanced even)) that SqlServer for example has replication services with publishers and subscribers to keep databases in sync. It's a complicated matter, keeping databases in sync, so if you add data to both and they have to be synced with eachother it will be a bit of a problem to get that right, you might want to look into specialized software for that.

Frans Bouma | Lead developer LLBLGen Pro