MikaelEliasson / EntityFramework.Utilities

Provides extensions for EntityFramework that doesn't exist out of the box like delete and update by query and bulk inserts
443 stars 175 forks source link

Add deleteTop to delete a specific number of rows #54

Open andreasbergqvist opened 9 years ago

andreasbergqvist commented 9 years ago

I had the need to delete a maximum number of rows in a table with LOTS of rows. Using "batch delete" seemed to be a solution.

Don't know if you agree with how I added the code but the result is being able to create a: DELETE TOP (*) FROM... query.

MikaelEliasson commented 9 years ago

Interesting. Will take a look at this after we shipped at work this week. Preferebly I would prefer if it was possible to get it to work with Take(x) to avoid adding too many methods.

andreasbergqvist commented 9 years ago

My first thought was using Take(x) too. But it seemed a bit strange to be able to use it on all batch commands (incl update). And I didn't wanna mess too much in your code.