What I want to do is append to a record's note column.
What I do not want to do is fetch the whole record, which is very significant.
Here's code that does not work:
string AppendNote(int key, string note)
{
using (MyEntities _Context = new MyEntities())
{
var _Record = _Context.Records
.Where(x => x.Id == key)
.Select(x => new Record { Id = x.Id, Notes = x.Notes })
.First();
_Record.Notes += note;
_Context.SaveChanges();
}
}
What is the correct way?
I realize it is very similar to this VERY OLD question: Update statement with Entity Framework and this similar but ultimately dissimilar question: How to update a record without selecting that record again in ADO.NET Entity Framework? but, still, it seems there has to be a way.