Which attribute should you use?
You are implementing an ASP.NET application that will use session state in out-of-proc mode.
You add the following code.
public class Person
{
public string FirstName { get; set;}
public string LastName { get; set;}
}
You need to add an attribute to the Person class to ensure that you can save an instance to session state.
Which attribute should you use?
Which code segment should you insert at line 03?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You are creating the data layer of the application. You write the following code segment. (Line numbers are included for reference only.)
01 public static SqlDataReader GetDataReader(string sql){
02 SqlDataReader dr;
03
04 return dr;
05 }
You need to ensure that the following requirements are met:
The SqlDataReader returned by the GetDataReader method can be used to retrieve rows from the database.
SQL connections opened within the GetDataReader method will close when the SqlDataReader is closed.
Which code segment should you insert at line 03?
Which code segment should you use?
You are consuming a Windows Communication Foundation (WCF) service in an ASP.NET Web application. The service interface is defined as follows.
<ServiceContract()>
Public Interface ICatalog
<OperationContract()>
<WebGet(UriTemplate:=”/Catalog/Items/{id}”, ResponseFormat:=WebMessageFormat.Json)>
Function RetrieveItemDescription(ByVal id As Integer) As String
End Interface
The service is hosted at /Catalog.svc. You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?
What are two possible code segments that you can use to achieve this goal?
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.
The application includes self-tracking entities as shown in the following diagram.
There is a Person entity names person1 that has TrackChanges turned on.
You need to delete all e-mail addresses that are associated with person1 by using an ObjectContext.
What are two possible code segments that you can use to achieve this goal?
(Each correct answer presents a complete solution. Choose two).
Which code segment should you add?
You are implementing a method in an ASP.NET application that includes the following requirements.
* Store the number of active bugs in the cache.
* The value should remain in the cache when there are calls more often than every 15 seconds.
* The value should be removed from the cache after 60 seconds.
You need to add code to meet the requirements.
Which code segment should you add?
What should you do?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application uses the ADO.NET Entity Framework to model entities. The application allows users to make changes to entities while disconnected from the central data store.
You need to ensure that when the user connects to the central data store and retrieves new data, the application meets the following requirements:
Changes made to the local data store in disconnected mode are preserved.
Entities that have already been loaded into the local data store, but have not been modified by the user, are updated with the latest data.
What should you do?
What should you do?
A Windows Communication Foundation (WCF) service has a callback contract. You are developing a client application that will call this service. You must ensure that the client application can interact with the WCF service. What should you do?
Which code segment should you use?
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. The application includes two ObjectContext instances named context1 and context2.
You need to persist the changes in both object contexts within a single transaction. Which code segment should you use?
Which code segment should you add?
You are implementing an ASP.NET application that includes the following requirements.
Retrieve the number of active bugs from the cache, if the number is present.
If the number is not found in the cache, call a method named GetActiveBugs, and save the result under the ActiveBugs cache key.
Ensure that cached data expires after 30 seconds.
You need to add code to fulfill the requirements.
Which code segment should you add?
What should you do?
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?