Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using AddOrUpdate from System.Data.Entity.Migrations
Message
From
08/04/2014 15:14:05
 
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01598293
Message ID:
01598298
Views:
40
>We're having a debate about whether to use EF AddOrUpdate.
>
>According to Julie Lerman at http://thedatafarm.com/data-access/take-care-with-ef-4-3-addorupdate-method/ you should only use AddOrUpdate when doing Data Migrations during development.
>
>My co-workers are saying that using AddOrUpdate is acceptable even though it makes a round trip query to the database to see if the record exists in order to determine whether it creates an update or an insert command. I've seen that in SQL Profiler.
>
>And Julie makes other arguments against its use as well.
>
>Thanks.

I was about to reply with the same thing that Naomi said. The MERGE statement in SQL 2008 (plus the ability to pass data tables as parameters to stored procs) gives you more power in the database engine. There are strong arguments to do this in the database layer.
Previous
Reply
Map
View

Click here to load this message in the networking platform