开发者

Sync two SqlExpress using NHibernate

开发者 https://www.devze.com 2022-12-18 04:06 出处:网络
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).

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,开发者_StackOverflow社区 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


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

-sa

0

精彩评论

暂无评论...
验证码 换一张
取 消