DeleteObject for more than one element

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Posts: 16
Joined: Tue 23 Feb 2010 18:28

DeleteObject for more than one element

Post by lancelotti » Tue 06 Apr 2010 13:09

It works...

Code: Select all

var tmp = db.Relacionadas.First(r => r.NoticiaId == noticia.Id);

But it not.

Code: Select all

var tmp = db.Relacionadas.Where(r => r.NoticiaId == noticia.Id);
It I try .First() / .Single() ou etc, it works, but if I try to delete all objects in relation .Any() / .ToList() / .Select(), it doesn't.

I got this error in the second case
The object cannot be deleted because it was not found in the ObjectStateManager.

Any idea? Tks.

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 08 Apr 2010 08:55

The DeleteObject method does not support batch deleting.
More information is available here: ... bject.aspx

Post Reply