0

I am creating a simple project management system which uses NHibernate for object storage. The underlying database is SQL express (at least currently for development).

The client runs on either the desktop or laptop. I know I could use web-services and store the DB only on the desktop, but this would force the desktop to be available all the time.

I am currently thinking about duplicating the DB, having two instances with "different data". To clarify, we are not talking about a productive app here, its a prototype.

One way to achieve this very simple would be the following process:

  • Client: Check if desktop DB is available (through web service)
  • Client: If yes, use desktop storage, no problem here
  • Client: If not, use own DB as storage
  • Client: Poll desktop regulary, as soon as it comes on, sync
  • Client: Switch to desktop storage
  • ...
  • Desktop: Do not attempt any DB operation before checking for required sync
  • Desktop: If sync needed, do it...

My question is now, how would you sync? Assume 4 or 5 types of objects, all have GUID as identifiers. Would you always manually "lazy load" all objects of a certain type and feed them to the DB. Would you always drop the whole desktop DB in case the client DB may be newer and out of sync?

Again, I want to stress out, I am not assuming any conflicts or stale data, I basically just want to "copy the whole DB from the client". Would you use NHibernate for this? Or would you separate the copy process?

When I think about it, my questions comes down to this:

Is there any function from NHibernate:

SyncDBs_SourceWins_(SourceDB, TargetDB)

Thanks for help, Chris

Christian Ruppert
  • 3,749
  • 5
  • 47
  • 72

1 Answers1

0

Not NHibernate, but how about Sync Services for ADO.NET 2.0?

-sa

Sascha
  • 10,231
  • 4
  • 41
  • 65
  • Well, just took a short look. Not sure, but I don't think it can be used in combination with NHibernate. And I definitly need NHibernate (ok, want :-) Only this sync stuff just came up, for "convenience reasons" – Christian Ruppert Jan 28 '10 at 09:55
  • No, it is not NHibernate, but it should be possible to use them side by side though it's definitely not best looking. A question about integrating both worlds here on so is yet unanswered (http://stackoverflow.com/questions/1264161/does-nhibernate-intergrate-well-with-microsoft-sync-framework). Besides, doing it manually is tedious. A long work and you will most definitely ran into some strange situations. – Sascha Jan 28 '10 at 10:38
  • Ok, I will have a closer look on the sync framework. A little basic research can't hurt... – Christian Ruppert Jan 28 '10 at 15:51