views:

1077

answers:

2

I would like to submit a collection of entities one at a time.

There are 2 reasons for this: - I'm uploading a lot of data and submitting more than one change exceeds the http limit for these transfers. (i don't want to change this limit) - I want to see the progress of each item getting submitted.

Example: Suppose I have an album and each album has a collection of photos (entities). If the user adds some photos, I want to upload one photo at a time and not the whole chunk at once.

+1  A: 

SubmitChanges() will submit the changes in a changeset (all that have changed since you loaded it). I don't know how to modify it's behavior, but you could write your own update method in the service and pass in the object you want to update

Check out the riaservicesoverviewpreview.pdf at http://code.msdn.microsoft.com/RiaServices around page 50 for some info about the update.

Edit: I found this method yesterday while trying to do the same thing with WPF: link text. I used the idea of detaching and then attaching the entity (I'm using a single static global DataContext).

Kevin
+2  A: 

If you'd like to Submit one change at a time, simply call SubmitChanges upon committing an edit, or adding or deleting an entity...

Typically in your UI if you have some sort of commit button, then tie that to do two things - both the local commit, and subsequent SubmitChanges.

Note you can also override ValidateChangeSet on your DomainService to ensure there is only one operation in the ChangeSet. This ensures clients don't inadvertently try to commit more than one change at a time...

NikhilK

related questions