PrepAway - Latest Free Exam Questions & Answers

Tag: 70-516

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4

Which code segment should you use?

You are developing a new feature that displays an auto-complete list to users as the type color names. You have an
existing ContosoEntities context object named contex.

To support the new feature you must develop code that will accept a string object named text containing a user’s
partial input and will query the Colors database table to retrieve all color names that begin with that input.

You need to create an Entity SQL (ESQL) query to meet the requirement.
The query must not be vulnerable to a SQL injection attack. Which code segment should you use?

What should you do?

You are adding a process to the application. The process performs the following actions:
1. Opens a ContosoEntities context object named context1.
2. Loads a Part object into a variable named part1.
3. Calls the Dispose() method on context1.
4. Updates the data in part1.
5. Updates the database by using a new ContosoEntities context object named context2.

You need to update the database with the changed data from part1. What should you do?

<?xml version="1.0" encoding="utf-8"?

Refer to the following lines in the case study: PA40 in \Model\Part.cs, PR16 in\Model\Product.cs, and CT14 in \Model\Component.cs

The application must create XML files that detail the part structure for any product. The XML files must use the following format:

<?xml version=”1.0″ encoding=”utf-8″?>
<product name=”Brush” description=”Brush product” productType=”1″>
<component name=”Handle” description=”Handle” partType=”2″>
<component name=”Screw” description=”Screw” partType=”3″>
<component name=”Wood” description=”Wooden shaft” partType=”45″>
</component>
<component name=”Head” description=”Head” partType=”5″>
<component name=”Screw” description=”Screw” partType=”3″>
<component name=”Bristles” description=”Bristles” partType=”4″>
</component>
</product>

You need to update the application to support the creation of an XElement object having a structure that will serialize to the format shown above.
What should you do? (Each correct answer presents part of the solution. Choose two.)

What should you do?

You have an existing ContosoEntities context object named context.
Calling the SaveChanges() method on the context object generates an exception that has the following inner exception:

System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object ‘dbo.Colors’ with unique index ‘IX_Colors’.

You need to ensure that a call to SaveChanges() on the context object does not generate this exception. What should you do?


Page 6 of 19« First...45678...Last »