In my database, I have a single item that I want to update. I tried doing something like this, but it doesn't work:
db.Items.Where(t => t.Id == itemId).Select(t =>
{
t.CurrentValue = 99;
t.TotalValue = 999;
});
What works is this code, but I think that this is inefficient (am I wrong?):
db.Items.Single(t => t.Id == itemId).TotalValue = 999;
db.Items.Single(t => t.Id == itemId).CurrentValue = 99;
db.SaveChanges();
Is there a way to update different properties of a single object, with a single query?