Search code examples
rianamed

RIA Custom Update method


Given my RIA Service:

[Update]
public void Update(Car car)
{
   _carRepository.Update(car);
}

[Update(UsingCustomMethod = true)]
public void UpdateAndClone(Car car)
{
   _carRepository.UpdateAndClone(car);
}

How may I "map" SubmitChanges to my Custom update method from my Silverlight client side?

Public void Save(Action<SubmitOperation> submitCallback, object state)
{
  _carContext.SubmitChanges(submitCallback, state);
}

Public void SaveAndClone(Action<SubmitOperation> submitCallback, object state)
{
  _carContext.SubmitChanges(submitCallback, state);
  // _carContext.UpdateAndClone(????)
}

I would like my application to handle the update in two quite different ways according to which action is peformed by the user, but I'm having trouble to understand how my "custom" update should be used.


Solution

  • It seems that I can't have both a "standard" update and a custom update. So by calling the custom method in the viewmodel before doing .SubmitChanges() solves this issue.