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

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -