Elad Benda
Elad Benda

Reputation: 36654

How to save only a specific item using Entity Framework?

I'm using EF4 in my web application.

Currently, when I want to save a specific item, I change its properties, and then call SaveChanges().

But then all changes in the application are committed.

How can I commit changes of only specific item?

Upvotes: 2

Views: 205

Answers (1)

Mehmet Ataş
Mehmet Ataş

Reputation: 11549

Create a new context and attach your specific item to this new context. Then call SaveChanges() of the new context.

Upvotes: 3

Related Questions