EntityFramework .net 4 Update entity with a simple method

Posted by Dennis Larsen on Stack Overflow See other posts from Stack Overflow or by Dennis Larsen
Published on 2009-08-27T20:16:47Z Indexed on 2010/04/22 23:03 UTC
Read the original article Hit count: 310

I was looking at this SO question: http://stackoverflow.com/questions/1168215/ado-net-entity-framework-update-only-certian-properties-on-a-detached-entity. This was a big help for me. I know now that I need to attach an entity before making my changes to it. But how can do I do this:

I have an MVC website, a Customer Update Page with fields: ID, Name, Address, etc. My MVC is parsing this into a Customer entity. How do I do the following:

  • Update my entity and Save the changes to it.
  • Catch the exception if my changes have been made since I loaded my entity.

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about .NET