Entity Framework: Insert a new record and Update information of this record -


i don't know how can handle situation, can me ?

a. i insert new record table

var news = new news();  news.title = "hello world";  myrepository.insertnews(catid,news); 

in insertnews() function, call mydbcontext.savechanges(); , new record inserted database. in time, have id of new record.

b. after have id of new records, need call other functions process business , data update new record.

news.metadata = newdata; 

and call mydbcontext.savechanges();

my system displays error message. the property 'id' part of object's key information , cannot modified.

please me resolve issue. thanks

look @ thread :

the property 'id' part of object's key information , cannot modified


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -