Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating multiple rows with EF
Message
 
 
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01619231
Message ID:
01619243
Views:
36
>>>>Hi everybody,
>>>>
>>>>I did a quick research in Google and found that if we want to update multiple rows, we would need to loop through each row and update separately. I just want to make sure it's true and this is what I need.
>>>
>>>If I understand correctly, if there are 100 items in your collection, this will fire 100 UPDATE statements back to the database. Am I correct?
>>
>>Yes but in one transaction if we put SaveChanges at the end.
>
>I'm know you know this - it's very sad if indeed EF doesn't support table types. TTs were implemented in SQL 2008. I think nearly seven years is enough time. :)
>
>Actually, if you were using pure ADO.NET, you can pass a datatable to a proc and do the UPDATE in one DML statement.
>
>If EF can't do this, I think it's pretty unfortunate.

I can execute a stored procedure and perhaps pass the table valued parameter - there is a way to do it with EF. I may try to go this route, thanks for the idea.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform