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

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -