Entity framework: Delete objects that respects some conditions
Posted on 2010-09-20
I only want to know if this is possible to delete, with Entity Framework 4.0 some objects directly by specifying conditions.
I know I can select all object and then do a foreach on them and delete them. the goal is to avoid to retrieve data only to delete them. So please don't provide me a solution like
foreach( MyObjectType myObject in DataContext.MyObjectType.Where( <conditionsHere>))
The goal is to have something like:
DataContext.MyObjectType.Delete.Where(m=> m.date<= someOtherDate);