Using the default code generated entities with Entity Framework, is there a way to delete an entity object without using the ObjectContext? For example, self-tracking entities have a MarkAsDeleted method. Also, the ObjectContext isn’t needed to update or add objects, so I’m hoping the same applies to deleting objects.
One thing that doesn’t work is to simply mark the entity as deleted since the property is readonly:
foo.EntityState = EntityState.Deleted;
Answer seems to be no, so I’m using a technique I wrote about before to attach the
ObjectContextto all entities that need to delete child entities: http://sixfeetsix.blogspot.com/2012/06/provide-entityobjects-access-to-their.html