Is there a way to update a single table / entity without having to read the entity first into a list. This is the sql I am trying to achieve.
Update table set col1 = Case col2 When 0 then 1 else 0 end this updates roughly 500,000 records under a second
I do not want to do
List<table> updRecs = Context.tables.toList();
for each
{
if(col1 == 0)
col2 = true
else
col2 = false
}
Context.SaveChanges();
above is very slow roughly 4 minutes.
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.