C#C
C#2y ago
SWEETPONY

✅ is there any way to delete items from the database and return the deleted list in one request?

is there any way to delete items from the database and return the deleted list in one request?

I can do something like this:
DbContext.T.Where(entity => ..).ExecuteDelete()
, but my business logic assumes that I will return items that were deleted

I can do this:
var deleted = DbContext.T.Where(entity => ..)

DbContext.RemoveRange(deleted)

but these are already two requests to database
Was this page helpful?