Code: Select all
var tmp = db.Relacionadas.First(r => r.NoticiaId == noticia.Id);
db.DeleteObject(tmp);
But it not.
Code: Select all
var tmp = db.Relacionadas.Where(r => r.NoticiaId == noticia.Id);
db.DeleteObject(tmp);
I got this error in the second case
The object cannot be deleted because it was not found in the ObjectStateManager.
Any idea? Tks.