c# - selfTracking on Client error -


im using selftracking in entity framework.

the problem when save data works fine when save second time want add new object want update old 1 or dont anythjing if 1 wasnt modified.

i describe below:

i have user entity. create it, sth , create context, save , destroy context user isnt destroyed.

it works ok, user saved in database. invoke same method. create new context, save , there duplicate key violation (it doesnt know has update user tries insert it).

context.user.apllychanges(myuser); context.savechanges();

i tried different variations , each time there same error. doing wrong ?

thanks help.

when click save new context created have same entityobject had. wants add new object

i've worked poco (not self tracking) believe applies.

the thing must know if new or , update , add object context , change state modified. if leave added ef try insert db.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -