[Free] Get all latest Microsoft 70-516 Actual Tests 141-150

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. The application uses a Microsoft ADO. NET SQL Server managed provider. When a connection fails, the application logs connection information, including the full connection string. The information is stored as plain text in a .config file. You need to ensure that the database credentials are secure. Which connection string should you add to the .config file?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity Framework to manage order data. The application makes a Web service call to obtain orders from an order-tracking system. You need to ensure that the orders are added to the local data store. Which method should you call on the ObjectContext?

A.Attach

B.AttachTo

C.AddObject

D.ApplyCurrentValues

Correct Answer: C

QUESTION 143

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create an Entity Data Model using model-first development. The database has the following requirements:

each table must have a datetime column named time_modified

each table requires a trigger that updates the value of the time_modified column when a row is inserted or updated

You need to ensure that the database script that is created by using the Generate Database From Model option meets the requirements. What should you do?

A.Create a new T4 template, and set the DDL Generation template to the name of the new template.

B.Create a new Windows Workflow Foundation workflow, and set Database Generation Workflow to the name of the new workflow.

C.Add a DateTime property named time_modified to each entity in the model and set the property’s StoreGeneratedPattern to Computed.

D.Add a new entity named time_modified to the model, and modify each existing entity so that it inherits from the new entity.

Correct Answer: A

QUESTION 144

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 as shown in the following diagram.

You create an ObjectContext instance named objectContext1 and use it to create a SalesPerson instance named person1.

You create an ObjectContext instance named objectContext2 and use it to create a SalesTerritory instance named territory1.

You need to create and persist a relationship between person1 and terrotory1. What should you do?

A.Detach person1 from objectContext1.

Attach person1 to objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call SaveChanges on objectContext2.

B.Attach person1 to objectContext2.

Attach territory1 to objectContext1.

Set the SalesTerritory property of person1 to territory1.

Call SaveChanges on both objectContext1 and objectContext2.

C.Detach person1 from objectContext1.

Detach territory1 from objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call Refresh on both objectContext1 and objectContext2.

D.Attach person1 to objectContext2.

Detach territory1 from objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call Refresh on objectContext1.

Correct Answer: A

QUESTION 145

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. You create the following Entity Data Model.

You add the following code fragment:

using(var context = new AdventureWorksLTEntities())

{

Customer cust = context.Customers.First();

cust.CompanyName = “Contoso”;

int count = 0;

}

The changes to the cust entity must be saved. If an exception is thrown, the application will attempt to save up to 3 times. If not, an exception is thrown. Which code segment should you use?

You have executed the Where query extension method on your collection, and it returned IEnumerable of Car, but you want to assign this to a variable whose type is List Of Car. How can you convert the IEnumerable of Car to List of Car?

A.Use CType (C# cast).

B.It can’t be done.

C.Use the ToList() query extension method.

D.Just make the assignment

Correct Answer: C

QUESTION 147

When working with LINQ to SQL, what is the main object that moves data to and from the database?

A.DataSet

B.SqlDataAdapter

C.DataContext

D.Entity

Correct Answer: C

QUESTION 148

You want to use LINQ to SQL to run queries on a table that contains a column that stores large photos. Most of the time, you won’t need to view the photo, but occasionally you will need to see it. In the LINQ to SQL designer, which property can you set on the photo column to get the efficient loading of the data for most scenarios but still be able to retrieve the photo when needed?

A.Skip

B.Delay Loaded

C.Take

D.Auto Generated Value.

Correct Answer: B

QUESTION 149

You retrieved a row of data into an entity object by using a LINQ to SQL DataContext object. You haven’t made any changes to the object, but you know that someone else has modified the data row in the database table, so you rerun your query, using the same LINQ to SQL DataContext object, to retrieve the updated data. What can be said about the result of the second query?

A.It returns the updated data and you can use it immediately.

B.The changes are thrown out and you use the cached data, so you don’t see the changes.

C.An exception is thrown due to the difference in data.

D.An exception is thrown because you already have the object, so you can’t re-query unless you create a new DataContext object.

Correct Answer: B

QUESTION 150

You ran a LINQ to SQL query to retrieve the products that you are going to mark as discontinued. After running the query, you looped through the returned products and set their Discontinued property to true. What must you do to ensure that the changes go back to the database?