In the previous version we could do this to delete an entity without knowing whether it exists.
svc = new TestContext();
item = new TestEntity("item2pk", "item2rk");
svc.AttachTo("TestTable", item, "*");
svc.DeleteObject(item);
svc.SaveChanges();
The new TableOperations doesn’t have this syntax. Do I have to use this old method or is there a way? I’d like to be consistent because now all my code use the new classes for version 2.
edit: the title was misleading
You’ll need to use
TableOperation.Delete:The delete only works for entities that exist. Even though the old client had the
ContinueOnErroroption, it was not compatible with theBatchoperation (as explained here).The only way to have a successful batch of Deletes if you don’t know that the entity exists it to add them first (or replace them if they already exist):