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

  • SEARCH
  • Home
  • 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 3631582
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:24:56+00:00 2026-05-19T00:24:56+00:00

I am working on a client/server (WPF/WCF) application using the MVVM pattern. Properties on

  • 0

I am working on a client/server (WPF/WCF) application using the MVVM pattern.

Properties on the ViewModel are bound to properties on the Model such that when the Model is changed, the change is propagated immediately to the View.

When the user clicks refresh, any new/changed data on the server is merged into Model, so the refresh mechanism is working well.

How do I handle the user editing and saving properties? Here is what I want to happen:

  1. User clicks “Edit”
  2. User modifies values in TextBoxes
  3. User clicks “Save”
  4. Changes are sent to server
  5. If successful, server returns updated item, which is merged into
    Model, and the UI is updated.
  6. If not successful, server returns error and Model is not updated.

It seems that by using MVVM, the Model is updated at step 3 (making steps 5 & 6 redundant), and if an error occurs on the server, data at the client becomes inconsistent with the server.

Is there a best practice way to deal with this situation?

  • 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-19T00:24:57+00:00Added an answer on May 19, 2026 at 12:24 am

    The solution I have come up with is to create a second set of objects – ModelUpdates.

    When the user clicks Edit, a ModelUpdate object (which has the same properties as the Model object) is instantiated and the DataContext is switched to that object.

    When the user clicks Save, details of the ModelUpdate object are sent to the service. The service responds with details about the updated object, which are then merged into the Model repository.

    This means that the Model is only ever updated with data that has been successfully saved. If the object was saved incorrectly, the database version will be sent back to the client. If an error occurred in saving, the database version will be sent back to the client. If the server is unavailable, the client will keep the pre-edit version.

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

Sidebar

Related Questions

I'm working on a project in C# w/ XNA, and I want to reorganize
I have a script that appends some rows to a table. One of the

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.