Click here to Skip to main content
14,238,047 members
Articles » Web Development » ASP.NET » General » Alternatives

Extension Method to help with EF Code First updating

Rate this:
0.00 (No votes)
Please Sign up or sign in to vote.
0.00 (No votes)
24 Oct 2011CPOL
An Extension Method that might help you copy over the values from one object to another, provided they are of the same type.


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

1 Nov 2011
Daniel Lo Nigro
As far as I know, the "UpdateModel" method is designed to do this. Something like this should work, but I haven't tested it:public ActionResult Edit(Entity entity){ var entityInDbSet = _context.Set.SingleOrDefault(x => x.Id == entity.Id); UpdateModel(entityInDbSet); ...


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

George Danila
Software Developer (Junior) IT Perspectives
Romania Romania
No Biography provided


2 bookmarked