Ensurepass

QUESTION 71

The application user interface displays part names or color names in many places as ‘## Name ##’. You need to provide a method named FormattedName() to format part names and color names throughout the application. What should you do?

 

  1. Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:

public static string FormattedName (this IName entity){

return string.Format(“## {0} ##”, entity.Name)

}

 

  1. Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:

public static string FormattedName (this Color entity){

return string.Format(“## {0} ##”, entity.Name)

}

 

  1. Add the following code segment to the ExtensionMethods class in ExtensionMethods.cs:

public static string FormattedName (this Part entity){

return string.Format(“## {0} ##”, entity.Name)

}

 

  1. Add the following code segmend to the Color class in Color.cs:

public string FormattedName(){

return string.Format(“## {0} ##”, this.Name);

}

 

  1. Add the following code segmend to the Part class in Part.cs:

public string FormattedName(){

return string.Format(“## {0} ##”, this.Name);

}

 

Correct Answer: A

 

 

QUESTION 72

The entity data model must be configured to provide a way you cal the sp_FindObsolete stored procedure. The returned data must implement the Descendants property. In Visual Studio 2010, you open the Add functions Import dialog box from the EDMX diagram and enter the information shown in the following graphic. You need to complete the configuration in the dialog box. What should you do?

 

70-516-demo-9

 

  1. Click the Get Column Information button, click Create New Complex Type and then, in the Complex box, enter Parts.

  2. In the Returns a Collection Of area, click Scalars and then, in the Scalars list, click string

  3. In the Returns a Collection Of area, click Entities and then, in the Entities list, click Component

  4. In the Returns a Collection Of area, click Scalars and then, in the Scalars list, click Int32

 

Correct Answer: C

 

 

QUESTION 73

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. Entity types in the model are generated by the Entity Data Model generator tool (EdmGen.exe). You write the following code. (Line numbers are included for reference only.)

 

01 MemoryStream stream = new MemoryStream();

02 var query = context.Contacts.Include(“SalesOrderHeaders.SalesOrderDetails”);

03 var contact = query.Where(“it. LastName = @lastname”, new ObjectParameter(“lastname”, lastName)).First();

04 ….

 

You need to serialize the contact and all of its related objects to the MemoryStream so that the contact can be deserialized back into the model. Which code segment should you insert at line 04?

 

  1. var formatter = new XmlSerializer(typeof(Contact), new Type[]

{

typeof(SalesOrderHeader),

typeof(SalesOrderDetail)

});

formatter.Serialize(stream, contact);

 

  1. var formatter = new XmlSerializer(typeof(Contact));

formatter.Serialize(stream, contact);

 

  1. var formatter = new BinaryFormatter();

formatter.Serialize(stream, contact);

 

  1. var formatter = new SoapFormatter();

formatter.Serialize(stream, contact);

 

Correct Answer: A

 

 

QUESTION 74

You use Microsoft Visual Studio 2010 to create a Microsoft .NET Framework 4.0 application. You create an Entity Data Model for the database tables shown in the following diagram.

 

70-516-demo-10

 

You need to modify the .edmx file so that a many-to-many association can exist between the Address and Customer entities. Which storage Model section of the .edmx file should you include?

 

  1. <EntityType Name=”CustomerAddress”>

<Key>

<PropertyRef Name=”CustomerAddressID” />

<PropertyRef Name=”CustomerID” />

<PropertyRef Name=”AddressID” />

</Key>

<Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” />

<Property Name=”CustomerID” Type=”int” Nullable=”false”/>

<Property Name=”AddressID” Type=”int” Nullable=”false”/>

<Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50/>

</EntityType>

 

  1. <EntityType Name=”CustomerAddress”>

<Key>

<PropertyRef Name=”CustomerID” />

<PropertyRef Name=”AddressID” />

</Key>

<Property Name=”CustomerID” Type=”int” Nullable=”false” />

<Property Name=”AddressID” Type=”int” Nullable=”false” />

<Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50 DefaultValue=”Home” />

</EntityType>

 

  1. <EntityType Name=”CustomerAddress”>

<Key>

<PropertyRef Name=”CustomerAddressID” />

</Key>

<Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” />

<Property Name=”CustomerID” Type=”int” Nullable=”false”/>

<Property Name=”AddressID” Type=”int” Nullable=”false” />

<Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50/>

</EntityType>

 

  1. <EntityType Name=”CustomerAddress”>

<Key>

<PropertyRef Name=”CustomerID” />

<PropertyRef Name=”AddressID” />

</Key>

<Property Name=”CustomerID” Type=”int” Nullable=”false”/>

<Property Name=”AddressID” Type=”int” Nullable=”false”/>

<Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50″ />

</EntityType>

 

Correct Answer: D

 

 

QUESTION 75

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to ensure that the entities are self-tracking. What should you do in the ADO.NET Entity Framework Designer?

 

  1. Change the Code Generation Strategy option from Default to None.

  2. Change the Transform Related Text Templates On Save option to False.

  3. Add an ADO.NET Self-Tracking Entity Generator to the model.

  4. Add an ADO.NET EntityObject Generator to the model.

 

Correct Answer: C

 

 

QUESTION 76

You are developing an ADO.NET 4.0 application that interacts with a Microsoft SQL Server 2008 server through the SQL Server Native Client. You create a trace DLL registry entry and you register all of the trace schemas. You need to trace the application data access layer. Which control GUID file should you use?

 

  1. ctrl.guid.snac10

  2. ctrl.guid.mdac

  3. ctrl.guid.adonet

  4. ctrl.guid.msdadiag

 

Correct Answer: A

 

 

QUESTION 77

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to several SQL Server databases. You create a function that modifies customer records that are stored in multiple databases. All updates for a given record are performed in a single transaction. You need to ensure that all transactions can be recovered. What should you do?

 

  1. Call the RecoveryComplete method of the TransactionManager class.

  2. Call the EnlistDurable method of the Transaction class.

  3. Call the Reenlist method of the TransactionManager class.

  4. Call the EnlistVolatile method of the Transaction class.

 

Correct Answer: B

 

 

QUESTION 78

You are developing a WCF data service that will expose an existing Entity Data Model (EDM). You have the following requirements:

 

  • Users must be able to read all entities that are exposed in the EDM.

  • Users must be able to update or replace the SalesOrderHeader entities.

  • Users must be prevented from inserting or deleting the SalesOrderHeader entities

 

You need to ensure that the data service meets the requirements. Which code segment should you use in the Initialize method?

 

  1. config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);

config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.AllWrite);

 

  1. config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);

config.SetEntitySetAccessRule(“SalesOrderHeader”,

EntitySetRights.WriteMerge | EntitySetRights. WriteReplace);

 

  1. config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);

config.SetEntitySetAccessRule(“SalesOrderHeader”,

EntitySetRights.WriteAppend | EntitySetRights. WriteDelete);

 

  1. config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead);

config.SetEntitySetAccessRule(“SalesOrderHeader”, EntitySetRights.All);

 

Correct Answer: B

 < /strong>

 

QUESTION 79

You use Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The LINQ to SQL model contains the Product entity. A stored procedure named GetActiveProducts performs a query that returns the set of active products from the database. You need to invoke the stored procedure to return the active products, and you must ensure that the LINQ to SQL context can track changes to these entities. What should you do?

 

  1. Select the Product entity, view the entity’s property window, and change the Name for the entity to GetActiveProducts.

  2. Add a property named GetActiveProducts to the Product entity.

  3. Navigate to the GetActiveProducts stored procedure in Server Explorer, and drag the procedure onto the Product entity in the LINQ to SQL model designer surface.

  4. Select the Product entity, view the entity’s property window, and change the Source for the entity to GetActiveProducts.

 

Correct Answer: C

 

 

QUESTION 80

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an object context. A different application updates the database. You need to update the entity instance to reflect updated values in the database. Which line of code should you use?

 

  1. context.Refresh(RefreshMode.StoreWins, entity);

  2. context.LoadProperty(entity, “Client”, MergeOption.OverwriteChanges);

  3. context.AcceptAllChanges() ;

  4. context.LoadProperty(entity, “Server”, MergeOption.OverwriteChanges);

 

Correct Answer: A

 

Instant Access to Download Latest Complete Collection of Microsoft MCTS 70-516 Real Exam

Try Microsoft MCTS 70-516 Free Demo

 

Comments are closed.