Which two approaches should you recommend?
You are designing an ASP.NET Web application.
You have the following requirements:
– Users must be allowed to save their work in progress on one computer and to continue the work on another computer.
– Data that is submitted for processing must be valid, and invalid data must be rejected.
– Primary key constraints within the database must be enabled at all times.
– The application must store only data that is entered by the user.
You need to design data validation to support the requirements.
Which two approaches should you recommend?
(Each correct answer presents part of the solution. Choose two.)
[WebInvoke(UriTemplate = "/statuses/update.xml?
You are developing an application to update a users social status. You need to consume the service using Windows Communication Foundation (WCF).
The client configuration is as follow.
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name=”SocialConfig”>
<security mode=”TransportCredentialOnly”>
<transport clientCredentialType=”Basic” realm=”Social API” />
</security>
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint address=”http://contoso.com” binding=”webHttpBinding”
bindingConfiguration=”SocialConfig”
contract=”ISocialStatus” name=”SocialClient” />
</client>
</system.serviceModel>
The service contract is defined as follows.
[ServiceContract]
public interface ISocialStatus
{
[OperationContract]
[WebInvoke(UriTemplate = “/statuses/update.xml?status={text}”)]
void UpdateStatus(string text);
}
Which code segment should you use to update the social status?
Which code segment should you insert at line 11?
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.
You write the following code segment that executes two commands against the database within a transaction.
(Line numbers are included for reference only.)
01 using(SqlConnection connection = new SqlConnection(cnnStr)) {
02 connnection.Open();
03 SqlTransaction sqlTran = connection.BeginTransaction();
04 SqlCommand command = connection.CreateCommand();
05 command.Transaction = sqlTran;
06 try{
07 command.CommandText = INSERT INTO Production.ScrapReason(Name) VALUES(Wrong size);
08 command.ExecuteNonQuery();
09 command.CommandText = INSERT INTO Production.ScrapReason(Name) VALUES(Wrong color);
10 command.ExecuteNonQuery();
11 …
l2 }
You need to log error information if the transaction fails to commit or roll back. Which code segment should you insert at line 11?
What should you do?
You are analyzing a Windows client application that uses Microsoft Visual Studio 2010 and Microsoft SQL Server 2008 The application updates two database tables from the main user interface (UI) thread You need to ensure that the following requirements are met
+ The database tables are either updated simultaneously or not updated at all
+ Users are notified of the success or failure of the updates
+ Users are able to perform other tasks during the update process
What should you do?
Which approach should you recommend?
You have an ASP.NET Web Forms application for processing orders.
Many users of the application submit their order forms multiple times due to incorrectly formatted credit card information.
You need to plan for validation of the length and format of data in the credit card field on the client side prior to processing each transaction.
Which approach should you recommend?
What should you do?
You are creating a Windows Communication Foundation (WCF) service. The service endpoints change frequently.
On the service, you add a new ServiceDiscoveryBehavior to the Behaviors collection of the ServiceHost Description property.
You need to ensure that client applications can communicate with the service and discover changes to the service endpoints.
What should you do?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Forms application.
The application connects to a Microsoft SQL Server database.
You need to find out whether the application is explicitly closing or disposing SQL connections. Which code segment should you use?
What should you do?
You are designing a Windows Presentation Foundation (WPF) application by using Microsoft .NET Framework 4 and Microsoft Visual Studio 2010.
The application will consist of a user interface (UI) tier and a middle tier. The middle tier will be implemented by using Windows Communication Foundation (WCF). You plan to design the exception handling strategy for the application. Each method in the middle tier will contain the following catch block.
Catch e As Argument Null Exception
Throw
When testing the application, you discover that all Argument Null Exceptions that occur in the middle tier do not contain accurate stack trace information.
What should you do?
Which approach should you recommend?
You are designing an ASP.NET MVC 2 Web application.
You have the following requirements:
– Type safety must be validated at compile time.
– Code must not require explicit run-time type casting.
You need to pass data between the controllers and the views within the Web application.
Which approach should you recommend?
Which binding elements should you use?
You develop a Windows Communication Foundation (WCF) service that interacts with Microsoft Message Queuing (MSMQ). The service requires sessions.
You need to create a custom binding that enables messages sent to the queue to be viewed when you are using a listener tool.
Which binding elements should you use?