Take the 2-minute tour ×

There are situations where I only want to update a specific field of a single entity in the database.

I loaded the entities of that type into my silverlight application, and I know they are constantly changing on the server... but there is one field which has to be set by the silverlight client... the server will only read it. How can I just send the new data for that field to the server?

Example an Entity called "TextField". I have a list of TextFields loaded in the silverlight application and every now and then the user will update the Preload (string) property of an entity and that has to go back to the server without changing anything else on the server.

I tried adding a simple SetPreloadText(...) method to the DomainService but that just makes Silverlight crash with some odd error code.

Is there a way to this? Am I working against the idea of Silverlight here? I really don't want to send the entire object back because know that at any given time the version on the client will most likely be out of date. (which is ok for this specific application)

share|improve this question

2 Answers 2

I think SetPreloadText(..) chrashes because RIA Services uses special naming coneventions like insert/update/delete for crud unless you specify it to be named different.

If you only want to update a specific property because the other my not have changed. You should look at

this.Context.AttachAsModified(currentEntityWithAllTextFields, this.ChangeSet.GetOriginal(currentEntityWithAllTextFields));

in your update method. With this you can exactly filter out what changed...

hope this helps...

share|improve this answer
The AttachAsModified method is not available... not in the service and not on the client, any ideas? –  TimothyP Apr 4 '10 at 9:39
are you using SL3 and RIA services beta, or SL4 and RIA services RC? If you are using the RC, AttachAsModified has been moved to the entityset, so it would this.Context.TextFields.AttachAsModified –  ดาว Apr 6 '10 at 1:27
SL4 RC, I'll have a look –  TimothyP Apr 7 '10 at 10:43

Now you need to use this :

  this._yourENtitySet.Value.ApplyCurrentValues(modified); // The one you received
  this._yourENtitySet.Value.ApplyOriginalValues(original); /// The original one

Hope this help !

share|improve this answer

Your Answer


