This is a migrated thread and some comments may be shown as answers.

Bulk delete and context changes

0 Answers 29 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernd
Top achievements
Rank 2
Bernd asked on 05 Jan 2017, 08:35 AM

Hi there.

I a larger operataion I am using the bulk delete and later on the GetChanges to tell clients what happend. It seems the bulk deletes are not logged. Is that a flaw or by design? How can I get the deleted rows?

The code snippet:

01. IQueryable<CalendarEvent> eventsToDelete = _db.CalendarEvents.Where(...);
02.eventsToDelete.DeleteAll();
03.// do some other stuff
04. 
05.// GetChanges
06.ContextChanges contextChanges = _db.GetChanges();
07.result.Created = contextChanges.GetInserts<CalendarEvent>();
08.result.Updated = contextChanges.GetUpdates<CalendarEvent>();
09.result.Deleted = contextChanges.GetDeletes<CalendarEvent>();
10. 
11.// the ids of the created rows are filled during SaveChanges
12._db.SaveChanges();
Tags
Data Access Free Edition
Asked by
Bernd
Top achievements
Rank 2
Share this question
or