###BeginCaseStudy###
Case Study: 1
Scenario 1
Background
You are developing a flight information consolidation service. The service retrieves flight
information from a number of sources and combines them into a single data set. The
consolidated flight information is stored in a SQL Server database. Customers can query
and retrieve the data by using a REST API provided by the service. The service also offers
access to historical flight information. The historical flight information can be filtered and
queried in an ad hoc manner. The service runs on a Windows Azure Web Role. SSL is not
used.
Business Requirements
• A new data source for historical flight information is being developed by a contractor
located on another continent.
• If a time zone is not specified, then it should be interpreted as Coordinated Universal
Time (UTC).
• When you upgrade a service from a staging deployment to a production deployment,
the time that the service is unavailable must be minimized.
• The default port must be used for HTTP.
Technical Requirements
The existing sources of flight information and the mechanism of exchange are listed below.
• Blue Yonder Airlines provides flight information in an XML file.
• Consolidated Messenger provides flight information in a Microsoft Access database
that is uploaded every 12 hours to the service using SFTP. The company uses port 22 for
SFTP.
• Margie’s Travel provides and consumes flight information using serialized ADO.NET
DataSets. Data is periodically synced between the service and Margie’s Travel.
• Trey Research provides data from multiple sources serialized in proprietary binary
formats. The data must be read by using .NET assemblies provided by Trey Research. The
assemblies use a common set of dependencies. The current version of the Trey Research
assemblies is 1.2.0.0. All assemblies provided by Trey Research are signed with a key pair
contained in a file named Trey.snk, which Trey Research also supplies.
• The application specification requires that any third-party assemblies must have
strong names.
Application Structure
###EndCaseStudy###
Errors occasionally occur when saving data using the FlightInfoContext ADO.NET Entity
Framework context. Updates to the data are being lost when an error occurs. You need to
ensure that data is still saved when an error occurs by retrying the operation. No more than
five retries should be performed. Which code segment should you use as the body of the
SaveChanges() method in the FlightInfoContext.es file?
Really now…
What is the difference between A and D ?
It will continue if it’s Transient and if it’s not!
ether way it’s the same outcome.
The diference is (!) !IsTransient
It is A because
IsTransient method determines whether the specified exception represents a transient failure that can be compensated by a retry.
but that code block doesn’t make any difference. if error code is transient then also program looping for five times. Should be there else block which exit from loop.
I guess you know the difference between if(IsTransient(ex.Number) and if(!IsTransient(ex.Number)). Also I guess you know the difference between continue and break. If I am right then you will figure out that the answer A is correct.
#Amar is right, if u test both u will see the same output.
I think the correct answer should be ‘D’ if it change ‘continue’ by ‘break’.
I think the correct answer is C.
Because there are some error codes that already known so if server returns a known error code, the loop retries should be BREAK.
None of the provided answers are correct. As stated earlier A and D both loop for 5 failures before continuing out of the loop. C exits the loop on the first transient failure and doesn’t repeat. B checks the wrong propery on the error. I guess the code should be something like:
for(var i = 0; i < 5; i++)
{
try
{
return base.saveChanges();
}
catch(SqlException ex)
{
if (!IsTransient(ex.Number))
{
throw;
}
}
}
return base.SaveChanges();