Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 299917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:52:00+00:00 2026-05-12T06:52:00+00:00

I have an application with the architecture like client/server/db . Communication between client and

  • 0

I have an application with the architecture like client/server/db. Communication between client and server is WCF (has been migrated from asmx) and database is SQL Server 2005.

The project has a requirement, that you cannot update an order, which have been changed (updated) by another user after your initial read. A common requirement in most applications I think.

An update of an order is usually as:

  1. Client read an order – an initially-read copy is stored (Session) on the server
  2. Client updates order – returns updated-order to server
  3. Server will read order again from database and compare with initially-read to check, if order has been changed by another user – in case client will be notified to re-read order
  4. Server will save changes

This way to handle data change has the effect, that at a certaint point (3), the server will have 3 (different) copies of the order in memory! Anyone knows another strategy for this?

We are running WCF with AspNetBackwardCompability, because we need the Session-variable to “hold” the initially-read copies – it will make my day, if we could dump that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:52:00+00:00Added an answer on May 12, 2026 at 6:52 am

    One solution is to have the client supply both the initially-read values and the updated values when saving. Then you don’t need a copy of the original values in session.

    DataSets have the built-in capability to store both versions (DataRowVersion.Original and DataRowVersion.Current), but you’ll have to provide your own method to do this (e.g. an operationContract:

    SaveMyData(MyType original, MyType updated);
    

    You can then save to the database thus:

    UPDATE MyTable
    SET Col1 = @NewCol1, Col2 = @NewCol2, ...
    WHERE Col1 = @OldCol1, Col2 = @OldCol2, ...
    IF @@ROWCOUNT = 0 ... update failed ...
    

    Alternatively you can have a TIMESTAMP / ROWVERSION column in your table. You roundtrip this to the client, and test it when updating:

    UPDATE MyTable
    SET Col1 = @NewCol1, Col2 = @NewCol2, ...
    WHERE PKCol = @PK AND TimeStampCol = @OldTimeStamp
    IF @@ROWCOUNT = 0 ... update failed ...
    

    You are of course relying on the client to correctly return the original values / original timestamp when saving. But this isn’t a security issue – a malicious client can’t do any more damage than it could with your session-based solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 153k
  • Answers 153k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can try these links OpenVP (is a free and… May 12, 2026 at 10:23 am
  • Editorial Team
    Editorial Team added an answer You would have to build it yourself. Parameters are not… May 12, 2026 at 10:23 am
  • Editorial Team
    Editorial Team added an answer Creating menus like this isn't currently available in the IntelliJ… May 12, 2026 at 10:23 am

Related Questions

Our customer would like to know who is online and currently using the custom
I'm trying to move toward TDD, ORM, Mocking, ect. I need a good example
I want to develop a multi-server clustered framework that will work similarly to the
Do we really need a server side architecture to create a RIA application? My
I am new to web programming, coming from a video game development background (c++),

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.