I am using self-servicing and would like to delete an entity with a primary key that is an identity field. I would like to do this directly with one hit to the database (i.e. not select then delete). The docs show this:
Method 2: use a new entity object to directly delete an entity from the database. Just set the PK fields to a value.
SelfServicing, deleting the customer "FISSA" from Northwind (doesn't violate any FK constraints)
// C#
CustomerEntity customer = new CustomerEntity();
customer.CustomerID = "FISSA";
customer.Delete();
When I do this I get the following error message:
The field 'PostID' is read-only and can't be changed.
I assume it is read-only because it is an identity field. So what is the correct way to accomplish this with only one DB hit?