nerdexam
Microsoft

70-516 · Question #188

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to model entities. The conceptual schema definition…

The correct answer is C. DbDataRecord nestedRecord = rdr["EmailPhoneComplexProperty"]. See the full explanation below for the reasoning.

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to model entities. The conceptual schema definition language (CSDL) file contains the following XML fragment. <EntityType Name="Contact"> ... <Property Name="EmailPhoneComplexProperty" Type="AdventureWorksModel.EmailPhone" Nullable="false" /> </EntityType> ... <ComplexType Name="EmailPhone"> <Property Type="String" Name="EmailAddress" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Type="String" Name="Phone" MaxLength="25" FixedLength="false" Unicode="true" /> </ComplexType> You write the following code segment. (Line numbers are included for reference only.) 01 using (EntityConnection conn = new EntityConnection("name=AdvWksEntities")) 02 { 03 conn.Open(); 04 string esqlQuery = @"SELECT VALUE contacts FROM 05 AdvWksEntities.Contacts AS contacts 06 WHERE contacts.ContactID == 3"; 07 using (EntityCommand cmd = conn.CreateCommand()) 08 { 09 cmd.CommandText = esqlQuery; 10 using (EntityDataReader rdr = cmd.ExecuteReader()) 11 { 12 while (rdr.Read()) 13 { 14 ... 15 } 16 } 17 } 18 conn.Close(); 19 } You need to ensure that the code returns a reference to a ComplexType entity in the model named EmailPhone. Which code segment should you insert at line 14?

Options

  • Aint FldIdx = 0;
  • BIExtendedDataRecord record = rdr["EmailPhone"]as
  • CDbDataRecord nestedRecord = rdr["EmailPhoneComplexProperty"]
  • Dint fieldCount =

How the community answered

(67 responses)
  • A
    4% (3)
  • B
    7% (5)
  • C
    72% (48)
  • D
    16% (11)

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice