views:

24

answers:

1

I am using WCF Data Services and let's say a user creates a row in a datagrid (via AddObject) and then decides they do not want it after all so they would like to go ahead and delete it.

So in this scenario, the item is in the DataContext but no in the Database yet. How can I do this?

Any advice will be greatly appreciated.

A: 

You need to be able to detect that a row has been added locally (e.g. by setting it's primary key column to a negative value or something, or by having a specific flag).

When the user deletes a row from your grid, you need to check whether or not that's a row that needs to be deleted from the database / WCF Data Service or not.

marc_s
Thanks for you reply but that does not work. When setting the PKs, they have to be unique when using Batch mode over the wire.
@user118190: ok, so make them unique! First one is -1, second is -2, third is -3 - works for me...
marc_s