Last active
September 15, 2017 19:52
-
-
Save yostane/0675df70b8d96bbae5bea4cc653b90c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The "duration" variable contains Execution time when we delete entities using for loop | |
| using (var context = new VideoGamesDatabaseContext()) | |
| { | |
| start = DateTime.Now; | |
| //delete all previous entitiies | |
| foreach (var videoGame in context.VideoGames.Where(predicate)) | |
| { | |
| context.Remove(videoGame); | |
| } | |
| context.SaveChanges(); | |
| duration = DateTime.Now - start; | |
| } | |
| //The "duration" variable contains Execution time when we delete entities using EF Plus | |
| using (var context = new VideoGamesDatabaseContext()) | |
| { | |
| start = DateTime.Now; | |
| var res = context.VideoGames.Where(vg => predicate(vg)).Delete(x => x.BatchSize = 500); | |
| //no need to save context | |
| duration = DateTime.Now - start; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment