Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2005, 02:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default Same file or changed?

Currently, I am playing around with a web service, which - on request - reads a file and sends back an object representing the contents of the file.

The consumer-side recieves the object and possibly make changes to it and post it back, where it is stored/updated in the same file.

However, I want some mechanism, which check if it is actually the same file as when it was requested in the first place. Some other person might have changed it while it was being edited. If that is the case it should not be updated, but the user should be made aware of the fault.

I have thought about several options, but I not sure what the best practice is. Here is what I though...

- Checksum, calculate when requested send it together with the object and check when the changes are submitted. I do not want to implement all kinds of algorithms, so what are my options i C#, if this is the best way?

- Reading the file properties and instead of sending the checksum with the object, then send the time it was last changed. Is this a possible solution?

Thanks a lot, Jacob.
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).
 
Old July 8th, 2005, 08:50 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I would think that a timestamp would be sufficient. Like you described, have the web service reply with the file contents along with the timestamp on the file. Send the timestamp back when you call the service with a file update. Compare and verify the timestamps match to catch a concurrency disruption.

-Peter
 
Old July 8th, 2005, 09:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter, that's going to be the solution, and I guess also the easiest to implement ;) .

Jacob.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How can the mousepointer be changed? apike VBScript 0 April 17th, 2007 10:38 PM
export excel file ( format is changed ) urgent palanivel jayanthi ASP.NET 1.0 and 1.1 Professional 1 March 12th, 2007 05:32 PM
export excel file ( format is changed ) urgent palanivel jayanthi ASP.NET 1.0 and 1.1 Basics 1 March 12th, 2007 05:31 PM
web config file format changed sarah lee ASP.NET 1.0 and 1.1 Basics 0 September 29th, 2006 01:31 PM
Getting CHANGED value from Datagrid? Ron Howerton Pro VB.NET 2002/2003 5 January 5th, 2005 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.