EntityFramework .net 4 Update entity with a simple method
- by Dennis Larsen
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.