YouareimplementinganASP.NETapplicationthatusesLINQtoEntitiestoaccessandupdatethedatabase.TheapplicationincludesthefollowingmethodtoupdateadetachedentityoftypePerson.YouneedtoimplementtheUpdatePersonmethodtoupdatethedatabaserowthatcorrespondstothepersonToE

题目

YouareimplementinganASP.NETapplicationthatusesLINQtoEntitiestoaccessandupdatethedatabase.TheapplicationincludesthefollowingmethodtoupdateadetachedentityoftypePerson.YouneedtoimplementtheUpdatePersonmethodtoupdatethedatabaserowthatcorrespondstothepersonToEditobject.Whichcodesegmentshouldyouuse?()

A._entities.People.Attach(personToEdit);_entities.ObjectStateManager.ChangeObjectState(personToEdit,EntityState.Modified);_entities.SaveChanges();

B._entities.ObjectStateManager.ChangeObjectState(personToEdit,EntityState.Added);_entities.SaveChanges();

C._entities.People.ApplyCurrentValues(personToEdit);_entities.SaveChanges();

D._entities.People.Attach(newPerson(){Id=personToEdit.Id});_entities.ObjectStateManager.ChangeObjectState(personToEdit,EntityState.Modified);_entities.SaveChanges();


相似考题