views:

167

answers:

1

These web articles uses separate Save() and Update() methods for saving and updating an entity.

How can I write a SaveOrUpdate() method in Entity Framework with the help of ObjectContext and in Linq-To-SQL with the help of DataContext?

That is, how can I write a single method that shall do both save and update job?

A: 

Try looking at the Unit of Work pattern - Angry.Net Developer, ADO.NET team blog

Stephen Newman