Passing custom objects to Windows Mobile 6 Application
I have a website (lucky me) and in this website the data access is achieved using custom classes like this...
IList<Thing> things = ThingFactory.GetAll();
and
Thing thing = ThingFactory.Get(1);
...and everything is working just fine.
I've now been asked to develop a Windows Mobile 6/CF3.5 application (Windows Forms).
The application will pull down data from our server and store it in a SqlCe/Compact database for use offline. Any changes to the data (client or server) needs to be synchronised next time the device is docked.
Can someone please offer me some guidance on how I send data to and from the Mobile 开发者_如何学运维Application? My main question being is the following possible....
[WebMethod]
public IList<Thing> SyncThings(IList<Thing> thingsThatTheMobileChanged)
{
ThingFactory.SavedChangedThings(thingsThatTheMobileChanged);
return ThingFactory.GetAllThatHaveChangedSinceLastSync();
}
...and how is that consumed on the client/mobile side?
I have looked around at some other similar questions posted on SO, but I'm just not getting the answers I'm after!!
Many thanks for any help offered,
ETFairfax
you can try to serialize your list of objects and return array of bytes PDA will take this array of bytes and deserialize it.
I've used Syncing between SQL Server databases to great success. This will update your database whenever it's connected without any requirements from you, the developer. What this means for you is that instead of the application pulling new data,the application needs to just get objects from the database. You will probably want some sort of timestamp records in your database records so you know when they've changed.
[Disclaimer: I wrote my mobile app that talked to Compact SQL Server around 6 years ago; back when a mobile device was still called a PDA]
精彩评论