Last active
January 12, 2017 03:02
-
-
Save JonathanMagnan/f5d7ef68654c007a7194cd19cadb8fd1 to your computer and use it in GitHub Desktop.
This file contains 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
// using Z.EntityFramework.Plus; // Don't forget to include this. | |
// DELETE all users inactive for 2 years | |
ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) | |
.Delete(); | |
// DELETE using a BatchSize | |
ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) | |
.Delete(x => x.BatchSize = 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment