How to update a single field using EF4
I want to update a single field in my table for a particular row. I am using Entity Framework 4 and Visual Studio 2010.
Options I can think of are:
- Using a Stored Procedure
- Direct connection to the database and using sql statement
I am not aware of any more efficient method to p开发者_如何学Pythonerform this task.
[EDIT]
I would like to do the update in the same operation as the Get for that row, so that it is done in one DB call.No need to complicate things. Just change the one property and SaveChanges
. Unless you're doing something odd, that should only change the one column. Look at the SQL to verify.
精彩评论