Correct way to perform an update using ADO.Net Entity Model in .net 4
- by sf
Hi, 
I just wanted to clarify if this is the appropriate way to perform an update using a designer generated ADO.NET Entity Model.
I was wondering if there was a way to perform an update without creating the sqlMenu object. 
public class MenusRepository
{
    public void UpdateMenu(Menu menu)
    {
        // _context is instantiated in constructor
        Menu sqlMenu = (from m in _context.Menus where m.MenuId == menu.MenuId select m).FirstOrDefault();
        if (sqlMenu == null)
            throw new ArgumentException("Can't update a Menu which does not exist");
        // associate values here
        sqlMenu.Name = menu.Name;
        _context.SaveChanges();
    }
}