Click here to Skip to main content
15,883,901 members
Articles / Programming Languages / C#

Extension Method to help with EF Code First updating

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
1 Nov 2011CPOL 9.5K  
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); ...

Views

Daily Counts

License

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


Written By
Web Developer Facebook
United States United States
I'm a web developer specialising in ASP.NET MVC, PHP and JavaScript. I've got several years of web development experience and am always trying new technologies.

Comments and Discussions