简体   繁体   中英

Deleting Rows in a Database Table

What's the easiest way to delete rows in a database table using Entity Framework 6?

I just pulled down EF6 via NuGet and have been able to successfully query rows from the DB. However, I do not seem to have access to the context.<entity>.Delete() or context.<entity>.DeleteObject() methods, which are most often shown as examples online.

Got it working.

var query = <linq query>;

context.<entity>.RemoveRange(query);
context.SaveChanges();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM