可学答题网 > 问答 > MCTS(70-515)题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

You are implementing a


You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.The application includes the following method to update a detached entity of type Person. You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object. Which code segment should you use?()

  • 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(new Person() { Id = personToEdit.Id });_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Modified);_entities.SaveChanges();
参考答案
参考解析:
分类:MCTS(70-515)题库
相关推荐

1、You are implementing a

You are implementing an ASP.NET Web site that uses a custom server control named Task. Tas...

2、You are implementing a

You are implementing an ASP.NET application. You add the following code segment.You need to add...

3、You are implementing a

You are implementing a very simple TCP/IP network. It rarely changes and you would like to...

4、You are implementing a

You are implementing an ASP.NET MVC 2 Web application that contains several folders. The Views/...

5、You are implementing a

You are implementing an ASP.NET application that will use session state in out-of-proc mode. Yo...

6、You are implementing a

You are implementing an ASP.NET Web site. The site allows users to explicitly choose the d...