views:

14

answers:

1

We're building a Win Mobile 6 warehouse app which needs to update our server based corporate DB.

We've got a C# business layer that sits on our app server and we'd really like our warehouse app to go through this.

We also like MS Synch Services.

Is there a way to combine the two ie can we use sync services but get them to go through our business layer ? Has anyone done this and got an example I can follow ? Is there a best practice for this kind of scenario ?

Thanks,

Andy

A: 

Got it going by overriding apply changes: Server side (ie PFS.WarehouseHandheld.SyncServiceLibrary) 1. In the SyncServiceLibrary, create a new SyncContract implementation.

  1. The new SyncContract inherits the generated SyncService (& so implements the IXXXSyncService WCF interface.)

  2. In this new implementation, override ApplyChanges to intercept changes being pushed up to your server, loop thru changes detailed in passed param dataSet, determine table changed from dataSet.Tables[i].TableName.

  3. Hydrate the appropriate DTO from each row in the table & push it thru your appropriate BLL controller.

  4. In you library's app.config, plug in another system.serviceModel/services/service. THis should be the same as your original service node for the generated contract implementation but for a different name.

Client side (ie CF / windows mobile) 1. Add a web ref to your new service (ours is called PFSDatastore2CacheWebRefBLL) & hack it as directed in the walkthrough bove to remove duplicate generated code.

  1. In your Sync calling code, refer to the new BLL driven service (ie _webSvcProxy = new PFSDatastore2SyncServiceBLL();) and do as before.

Details at http://handhelddeveloper.wordpress.com/2010/05/18/sync-thru-your-business-layer/

Andy Kakembo