L2E for insert, update, delete

Posted by 5YrsLaterDBA on Stack Overflow See other posts from Stack Overflow or by 5YrsLaterDBA
Published on 2010-04-14T13:42:48Z Indexed on 2010/04/14 13:53 UTC
Read the original article Hit count: 549

Filed under:
|
|

I am using .Net3.5. Just wondering my understanding about the insert, update, delete are correct when use L2E.

For insert, we need two statements:

context.AddObject("entityName", newRow);
context.SaveChanges();

For update, we only need one statement:

context.SaveChanges();

For delete, we need two statements:

context.DeleteObject(deletedRow);
context.SaveChanges();

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ