Question

I have a Silverlight3 client consuming an unmodified/code-generated DomainService through RIA Services with a Linq-to-SQL back end. Is this the correct way to delete a row from the database?

this.context.Albums.Remove(this.context.Albums[0]);
this.context.SubmitChanges();

The SubmitOperation comes back with no errors, but no rows are ever deleted from the database. Inserts work just fine.

Was it helpful?

Solution

What does your corresponding DomainService have on the server?

Does it have a DeleteAlbum method, that attaches the Album to the Linq-to-SQL DataContext, and then calls DeleteOnSubmit?

Couple of things to try -

Override SubmitChanges on the server, and add a try/catch to see if you're hitting some exception.

Alternatively on the client, pass in a callback into SubmitChanges (i.e. use the other overload), and see if the SubmitOperation passed into the callback has its HasError property true, along with what the Error is.

Hope that helps narrow down the problem...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top