Deleting an entity instance

Deleting an entity is very easy, it's as simple as Saving an entity. Simply fetch the entity into memory and call Delete(). You can also delete an entity using an entity collection or remove it from the persistent storage directly (both methods use DeleteMulti overloads, see Deleting one or more entities from the persistent storage To delete it the simple way: fetch it and call delete:

var customer = new CustomerEntity("CHOPS");

It's recommended to add the entity object to a transaction object if you want to be able to roll back the delete later on in your routine. See for more information about transactions the section about Transactions.


Deletes are never recursive. This means that if the delete action of an entity violates a foreign key constraint, an exception is thrown. To prevent the exception, make sure the FK constraint in the database has been set to use CASCADE DELETE.