views:

229

answers:

2

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.

+1  A: 

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...

NikhilK
Yep - I discovered this myself but this is the correct answer.
Mike Hodnick
A: 

Hi Mike

did you find a answer/solution/workaround in the meantime? I have the same problem.

Thanks, Axel

Axel
My problem was because I was not calling "DeleteOnSubmit". There was no workaround.
Mike Hodnick