Total NOOB question. I have been using the new linqpad for about 20 minutes now. Great!
But now i want to delete a row in the db. I am using a EF5.0 connection. I cant seem to find anything in the help files or on the net. The only thing I can find is DeleteOnSubmit which doesnt work with EF (as far as I can see). I have also tried DeleteObject which doesnt work either. This is what I have tried.
var co = Companies.First();
co.Dump();
Companies.DeleteObject(co);
This is old... and I don't know if/when this was added (probably in response to this exact scenario)… but you can accomplish this (in your given example) as follows:
//test the following line to ensure the context doesn't complain about the .First() reference
Companies.DeleteOnSubmit(Companies.First());
Companies.Context.SubmitChanges();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With