Which of the following queries should you use?
You need to write a LINQ query that can be used against a ContosoEntities context object named context to find all
parts that have a duplicate name. Which of the following queries should you use?
(Each correct answer presents a complete solution. Choose two).
Which code segment should you use?
The database contains orphaned Color records that are no longer connected to Part records.
You need to clean up the orphaned records. You have an existing ContosoEntities context object named context.
Which code segment should you use?
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?
Which expression should you use?
The application must provide a component part list for any product. The component part list must give the quantity of
each distinct part that is required to manufacture that product.
You need to create a LINQ expression that delivers a a result of type IEnumerable<Tuple<int,Part>> to meet the requirements.
Which expression 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?
What should you do?
You need to ensure that an exception is thrown when color names are set to less than two characters. 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?
Which connection string fragment should you use?
The application must be configured to run on a new development computer.
You need to configure the connection string to point to the existing named instance.
Which connection string fragment should you use?
Which code segment should you use?
A performance issue exists in the application. The following code segment is causing a performance bottleneck:
var colors = context.Parts.GetColors();
You need to improve application performance by reducing the number of database calls. Which code segment should you use?