0

Searching here I see

db.ProRel.RemoveRange(db.ProRel.Where(c => c.ProjectId == Project_id));

can be used to remove a set of records. However, if you want to remove a large number of records, like 1000s or more, you don't want to bring them into memory. Can Linq do it, or do you do you need to drop into SQL?

1

1 Answer 1

1

There is a 3rd party library called EntityFramework.Extended that lets you do a batch to delete a set of specific rows. In your case it would be:

db.ProRel.Where(c => c.ProjectId == Project_id).Delete();
db.SaveChanges();

Just install this nuget package and execute the code I show above.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.