You need to ensure that all Contractors are bound to the Contractor class
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server 2008 database. The database includes a table that
contains information about all the employees. The database table has a field named EmployeeType
that identifies whether an employee is a Contractor or a Permanent employee. You declare the
Employee entity base type. You create a new Association entity named Contractor that inherits the
Employee base type. You need to ensure that all Contractors are bound to the Contractor class.
What should you do?
Which line of code should you use?
You use Microsoft .NET Framework 4 to develop an application that exposes a WCF Data Services
endpoint. The endpoint uses an authentication scheme that requires an HTTP request that has the
following header format.
GET /OData.svc/Products(l)
Authorization: WRAP access_token “123456789”
You add the following method to your DataService implementation.
Protected Overrides Sub OnStartProcessingRequest( ByVal args As
System.Data.Services.ProcessRequestArgs)
…
End Sub
You need to ensure that the method retrieves the authentication token. Which line of code should
you use?
You need to ensure that all generated entities inherit from MyBaseClass
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application.
You use the Entity Framework Designer to create the following Entity Data Model.
The application contains a class as shown in the following code segment.
Public Class MyBaseClass Inherits EntityObject
End Class
You need to ensure that all generated entities inherit from MyBaseClass.
What should you do?
Which code segment should you use?
You use Microsoft .NET Framework 4 and the Entity Framework to develop an application. You
create an Entity Data Model that has an entity named Customer. You set the optimistic concurrency
option for Customer. You load and modify an instance of Customer named loadedCustomer, which is
attached to an ObjectContext named context. You need to ensure that if a concurrency conflict
occurs during a save, the application will load up-to-date values from the database while preserving
local changes. Which code segment should you use?
Which code segment should you insert at line 04?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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 Dim stream As MemoryStream = New HemoryStream()
02 Dim query = context.Contacts.Include(
“SalesOrderHeaders.SaiesOrderDetails”)
03 Dim contact = query.Where(“it.LastName – Slostname”,
New ObjectParameter(“lastnarae”, 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?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that connects to a Microsoft SQL Server 2008 database. You use the ADO.NET Entity Framework
Designer to model entities. You add the following stored procedure to the database, and you add a
function import to the model.
CREATE PROCEDURE [dbo]. [InsertDepartment]
@Name nvarchar(50), @ ID int NULL OUTPUT
AS
INSERT INTO Department (Name) VALUES (@Name)
SELECT 6ID = SCOPE_IDENTITY()
You need to insert a new department and display the generated ID.
Which code segment should you use?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the ADO.NET Entity Framework to model entities. You create an entity model as shown in
the following diagram. You need to ensure that all Person entities and their associated
EmailAddresses are loaded.
Which code segment should you use?
Which code segment should you use?
You use Microsoft .NET Framework 4 to develop an application that connects to a local Microsoft
SQL Server 2008 database. The application can access a high-resolution timer. You need to display
the elapsed time, in sub-milliseconds (<1 millisecond), that a database query takes to execute. Which
code segment should you use?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the Entity Framework. The application defines the following Entity Data Model.
Within the .edmx file, the following function is defined.
<Functlon Name-“Round” RetuEnType-“Decimal”>
<Parametec Name-“val” Type-“Decimal” />
<DefiningExpression> CAST(val As Edm.Int32)
</DefiningExpression>
</Function>
The application includes the following LINQ query.
Dim query = From detail In context.SalesOrderDetails Select detail.LineTotal.Round()
You need to ensure that the Round function executes on the database server when the query is
executed. Which code segment should you use?
Which code segment should you insert at line 02?
You use Microsoft .NET Framework 4 to develop an application. You write the following code to
update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference
only,)
01 Private Sub ExecuteUpdate(ByVal cmd As SqlCommand, ByVal connString As String, ByVal
updateStrat As String)
02
03 End Sub
You need to ensure that the update statement executes and that the application avoids connection
leaks. Which code segment should you insert at line 02?