Am a little lost on this one. Getting the error Object reference not set to an instance of an object.
on the line db.EntityRichContents.DeleteAllOnSubmit(q);
at runtime. Project builds fine.
protected override void ControllerOnEntityDeleted(EntityObj forEntity, EntityDeletionController.DeletionAction newStatus)
{
if (newStatus == EntityDeletionController.DeletionAction.HardDelete)
{
if(forEntity == null) throw new Exception();
using (var db = new DBContext())
{
var q = db.EntityRichContents.Where(c => c.C3Entity == ForEntity.TypeID && c.C3EntityRecordID == ForEntity.ID);
db.EntityRichContents.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
Checking q.Any()
or q == null
doesn't help in any way (q isn't null).