I am new in Entity Framework. I want to remove multiple entities in one database context. If I used DBContext.Remove(Object) then It delete only the one entity from database. Please consider my code:
CCSRequest objCCSRequest = DBContext.CCSRequest.Find(ccsRequestId);
if (objCCSRequest != null)
{
DBContext.CCSRequest.Remove(objCCSRequest);
DBContext.SaveChanges();
}
CCProducts objCCProducts = DBContext.CCProducts.Find(ccsRequestId);
if (objCCProducts != null)
{
DBContext.CCProducts.Remove(objCCProducts);
DBContext.SaveChanges();
}
I want to remove entity in both CCSRequest and CCProducts table. Thank you in advance.