c# - What is the code for update in LINQ Method in EF? -
usually use following code update using linq method:
var original=context.division.where(c=>c.divisionid==adivision.divisionid).firstordefault(); context.division.applyoriginalvalues(original); context.division.applycurrentvalues(adivision); context.savechanges();
but way update in new version of ef?
i tried following code , works update.
context.division.attach(adivision); context.entry(adivision).state=entitystate.modified; context.savechanges();
Comments
Post a Comment