Entity deletion does not delete from database

Nov 25, 2012 at 2:44 PM

Whenever we delete an entity from an entity collection, on context.savechanges, it does not delete the entity from the database, just updates the foreign key field with Null. Is it by design or we are doing something wrong ?

Also thanks for all the support given.

Coordinator
Nov 27, 2012 at 1:47 AM

Would you please verify how you are doing this operation? This is just Entity Framework and so should work like any other EF app. To remove an entity from the database you should follow this pattern below where I get a Customer object and remove it.

using (var context = new MyEntities())
{
    var c = context.Customer.First();
    context.DeleteItem(c);
    context.SaveChanges();
}