How to update client side object instance using wcf ria service?

I had a problem calling the RIA WCF service again to update the client-side data. Here is my case:

On the server side, the domain service looks something like this:

public IQueryable<Person> GetPersonByID(int id)
       {
           var result = this.ObjectContext.Persons.
               Where(e => e.PersonID == id);
           return result; // check point 1
       }

On the client side, I make a call as follows (this is a call with the button that I called with the Refresh button):

this._amsService.Context.Load<Person>(
    this._amsService.Context.GetPersonByIDQuery(this.Person.ID),
    LoadBehavior.RefreshCurrent,
    result =>
    {
        this.Person = result.Entities.FirstOrDefault(); //check point 2
        this.RaisePropertyChanged("Person");     

    }, null);

Here is what I am trying:

Suppose I have a person in a database with data: personID=1, Age = 16.

  • Then run the application, I get the data correctly.

  • then go to the database, update the data using SQL to change Age = 20.

  • Then go back to the application and click the Refresh button to make a new call, but age is not updated to 20, it is still 16.

:

1 , , Age = 20.

2 result.Entities, , Age = 16.

LoadBehavior.MergeIntoCurrent,LoadBehavior.RefreshCurrent, .

, SL-, SL, . .

, . , , Age = 20.

?

+5
1

, ? , RIA .

IsEditing Person, . . var original = Person.GetOriginal()

0

All Articles