Likes

Developing Windows Azure and Web Services Lab @ 4 Ans 2

Consume the travelers' service from the client application. Start by implementing the GetTravelerAsync method by invoking a GET request to retrieve a specific traveler from the server. Continue by implementing the CreateTravelerAsync method by invoking a POST request to create a new traveler. And complete the exercise by implementing the UpdateTravelerAsync method by invoking a PUT request to update an existing traveler.
The main tasks for this exercise are:
1. Use System.Net.HttpCIient to get a list of destinations from the Destinations service.
2. Debug the BlueYonder.Companion.Client project.




To implement the required functionality, you need to perform the following steps:
1. Browse to the location where the Exercise 02.zip file is saved.
2. Extract the files.
3. Open Microsoft Visual Studio 2012.
4. Select FILE—Open—Project/Solution. The Open Project dialog box is displayed.
5. Browse to the location where the Exercise 02.zip file is extracted.
6. Double-click the Exercise 02 folder.
7. Double-click the BlueYonder.Companion.Client folder.
8. Select the BlueYonder.Companion.Client.sln file.
9. Click the Open button. The BlueYonder.Companion.Client - Microsoft Visual Studio window is displayed.
10. Select VIEW—Task List. The Task List window is displayed.
11. Select Comments from the Categories drop-down list in the Task List window.
12. Double-click the TODO: Exercise 2: Task 1a: implement the method by getting a traveler from the server comment under the Description column of the Task List window. The DataManager.es file is displayed.
13. Delete the highlighted portion of the following code snippet in the DataManager.es file:
/// <summary>
/// Get the traveler associated with this machine III </summary>
III <returnsx/returns>
public async Task<Traveler> GetTravelerAsync()
{
// TODO: Exercise 2: Task la: implement the method by getting a traveler from the server
throw new NotlmplementedException();
}
14. Type the highlighted portion of the following code snippet in the DataManager.es file: public async Task<Traveler> GetTravelerAsyncQ {
// TODO: Exercise 2: Task la: implement the method by getting a traveler from the server
var hardwareld = GetHardwareld();
HttpClient client = new HttpClient();
var travelersllri = string. Format("{0}travelers/{1}", BaseUri, hardwareld)
 HttpResponseMessage response = await client.GetAsync(new Uri(travelersUri if (response.IsSuccessStatusCode)
{
string resultlson = await response.Content. ReadAsStringAsync();
return await IsonConvert.DeserializeObjectAsync<Traveler>(resultJson)
}
else
{
return null;
}
15. Right-click the first line of code after the comment line in the GetTravelerAsync() method, and then select Breakpoint—Insert Breakpoint.
16. Double-click the TODO: Exercise 2: Task 1b: implement the method by using the HttpCIient class to invoke a POST request sending the traveler DTO comment under the Description column of the Task List window.
17. Delete the highlighted portion of the following code snippet in the DataManager.es file:
public async Task<Traveler> CreateTravelerAsync()
{
// TODO: Exercise 2: Task lb: implement the method by using the HttpClier class to invoke a POST request sending the traveler DTO throw new NotlmplementedExceptionQ;
}
18. Type the highlighted portion of the following code snippet in the DataManager.es file: public async Task<Traveler> CreateTravelerAsyncQ
{
// TODO: Exercise 2: Task lb: implement the method by using the HttpClien class to invoke a POST request sending the traveler DTO var dto = new TravelerDTOQ {
TravelerUserldentity = GetHardwareld()
h
string json = JsonConvert.SerializeObject(dto);
HttpCIient client = new HttpClientQ; var content = new StringContent(json);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json" HttpResponseMessage response = await client.PostAsync(
new Uri(_createTravelerUri), content);
var resultlson = await response.Content. ReadAsSt ringAsyncQ;
return await JsonConvert.DeserializeObjectAsync<Traveler>(resultJson);
}
19. Right-click the first line of code after the comment in the CreateTravelerAsyncO method, and then select Breakpoint—Insert Breakpoint.
20. Double-click the TODO: Exercise 2: Task 1c: implement the method by using the HttpCIient class to invoke a PUT request sending the traveler DTO comment under the Description column of the Task List window.
21. Delete the highlighted portion of the following code snippet in the DataManager.es file:
/// <summary>
III Modify the traveler details III </summary>
III <param name="traveler">The Traveler</param>
III <returnsx/returns>
public async Task UpdateTravelerAsync(Traveler traveler)
{
if (lawait NetworkManager.CheckInternetConnection(true, "")) return;
// TODO: Exercise 2: Task lc: implement the method by using the HttpCIient class invoke a PUT request sending the traveler DTO throw new NotlmplementedExceptionQ;
}
22. Type the highlighted portion of the following code snippet in the DataManager.es file: public async Task UpdateTravelerAsync(Traveler traveler)
{
if (lawait NetworkManager.CheckInternetConnection(true, "")) return;
// TODO: Exercise 2: Task lc: implement the method by using the HttpClient class invoke a PUT request sending the traveler DTO var dto = traveler.ToDTO(); dto.TravelerUserldentity = GetHardwareldQ; string json = IsonConvert.SerializeObject(dto);
HttpClient client = new HttpClient(); var content = new StringContent(json);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json" var travelerUri = string.Format("{0}/travelers/{l}">
BaseUri, dto.TravelerUserIdentity);
await client.PutAsync(new Uri(travelerUri), content);
}
23. Right-click the first line of code in the UpdateTravelerAsync() method, and then select Breakpoint—Insert Breakpoint.
24. Locate the string http://10.10.0.10/BlueYonder.Companion.Host/ and replace it with http://localhost/BlueYonder.Companion.Host/ in the DataManager.es file.
25. Select FILE—Save All to save the changes.
26. Press the Window logo key. The Start screen is displayed.
27. Start typing Visual Studio 2012.
28. Right-click theVisual Studio 2012 tile.The App bar is displayed.
29. Click the Run as administrator button on the App bar.
30. Select FILE—Open—Project/Solution. The Open Project dialog box is displayed.
31. Browse to the location where the Exercise 02.zip file is extracted.
32. Double-click the Exercise 02 folder.
33. Double-click the BlueYonder.Companion folder.
34. Select the BlueYonder.Companion.sln file.
35. Click the Open button. The BlueYonder.Companion - Microsoft Visual Studio window is displayed.
36. Ensure that the Solution Explorer window is opened.
37. Select DEBUG—Start Debugging. The Internet Explorer window is displayed.
38. Switch to BlueYonder.Companion.Client - Microsoft Visual Studio window.
39. Select DEBUG—Start Debugging. The BlueYonder Companion app's splash screen is displayed for a few seconds, and then the code execution breaks inside the GetTravelerAsync() method. In addition, the line in breakpoint is highlighted in yellow.
40. Press the F5 key to continue. Similarly, the code execution breaks at several places where you have added the breakpoints. You need to press the F5 key to continue the execution wherever it is interrupted because of the breakpoint until the BlueYonder Companion app is launched.
41. Click the Allow button, if you are prompted to allow the app to run in the background.
42. Right-click on the blank area of the app screen. The App bar is displayed at the bottom of the screen.
43. Click the Search button on the App bar. and then type New in the Search box.
44. Click the Allow button if you are prompted to allow the app to share your location. Wait for the app to show a list of flights from Seattle to New York.
45. Click Purchase this trip. The Purchase page is displayed.
46. Type your first name in the First Name text box.
47. Type your last name in the Last Name text box.
48. Type Aa1234567 in the Passport text box.
49. Type 555-5555555 in the Mobile Phone text box.
50. Type 423 Main St. in the Home Address text box.
51. Type your email address in the Email Address text box.
52. Click the Purchase button. If the code execution breaks, press the F5 key to continue.
53. Click the Close button when the message dialog is displayed.
54. Close the BlueYonder Companion app.
55. Switch to BlueYonder.Companion - Microsoft Visual Studio window.
56. Press the Shift+F5 keys to stop debugging the application.
57. Close both the Microsoft Visual Studio 2012 windows.

Developing Windows Azure and Web Services Lab @ 4 Ans 1

 Implement the travelers' service by using ASP.NET Web API. Start by creating a new ASP.NET Web API controller, and implement CRUD functionality using the POST, GET, PUT and DELETE HTTP methods.
The main tasks for this exercise is to create a new API controller for the Destinations service and implement the controller actions.




To implement the required functionality, you need to perform the following steps:
1. Browse to the location where the Exercise 01 .zip file is saved.
2. Extract the files.
3. Press the Window logo key. The Start screen is displayed.
4. Start typing Visual Studio 2012.
5. Right-click the Visual Studio 2012 tile. The App bar is displayed.
6. Click the Run as administrator button on the App bar.
Note: If User Account Control dialog box is displayed, click the Yes button. If the current user account does not have administrative rights, the User Account Control dialog box prompts for the administrator credentials. In this case, specify the administrator credentials, and then click the Yes button.
7. Select FILE—Open—Project/Solution. The Open Project dialog box is displayed.
8. Browse to the location where the Exercise 01 .zip file is extracted.
9. Double-click the Exercise 01 folder.
10. Double-click the BlueYonder.Companion folder.
11. Select the BlueYonder.Companion.sln file.
12. Click the Open button. The BlueYonder.Companion - Microsoft Visual Studio window is displayed.
13. Ensure that the Solution Explorer window is opened.
14. Right-click the BlueYonder.Companion.Controllers node, and then select Add—New Item. The Add New Item -BlueYonder.Companion.Controllers dialog box is displayed.
15. Select Web under the Visual C# Items node in the left pane.
16. Ensure that Web API Controller Class is selected in the middle pane.
17. Select and replace the existing text in the Name textbox with TravelersController.
18. Click the Add button. The TravelersController.es file is displayed.
19. Type the highlighted portions of the following code snippet in the TravelersController.es file: using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using BlueYonder.Entities;
using BlueYonder.DataAccess.Interfaces;
using BlueYonder.DataAccess.Repositories;
20. Replace the existing code within the TravelersController class in the TravellerController.es file with the following code snippet:
private ITravelerRepository Travelers { get; set; } public TravelersController()
{
Travelers = new TravelerRepository();
}
public HttpResponseMessage Get(string id)
{
var traveler = Travelers.FindBy(t => t.TravelerUserldentity = id).FirstOrDefault();
//Handling the HTTP status codes if (traveler != null)
return Request.CreateResponse<Traveler>(HttpStatusCode.OK, t
else
return Request.CreateResponse(HttpStatusCode.NotFound);
}
public HttpResponseMessage Post(Traveler traveler)
{
//Saving the new order to the database Travelers.Add(traveler);
Travelers.Save();
// creating the response, the newly saved entity and 201 Created var response = Request.CreateResponse(HttpStatusCode.Created, tr response.Headers.Location = new Uri(Request.RequestUri, traveler.TravelerId.ToString());
return response;
}
public HttpResponseMessage Put(String id, Traveler traveler)
{
// returning 404 if the entity doesn’t exist
if (Travelers.FindBy(t => t .TravelerUserldentity == id). FirstOrDe-f
null)
return Request.CreateResponse(HttpStatusCode.NotFound);
Travelers.Edit(traveler);
Travelers.Save();
return Request.CreateResponse(HttpStatusCode.OK);
}
public HttpResponseMessage Delete(St ring id)
{
var traveler = Travelers.FindBy(t => t.TravelerUserldentity id). FirstOrDefaultQ;
// returning 404 if the entity doesn’t exist if (traveler == null)
return Request.CreateResponse(HttpStatusCode.NotFound); Travelers.Delete(traveler);
Travelers.Save();
return Request.CreateResponse(HttpStatusCode.OK);
}
21. Ensure that the Solution Explorer window is opened.
22. Ensure that the BlueYonder.Companion.Host node is expanded.
23. Double-click the Web.config file under the BlueYonder.Companion.Host node. The Web.config file is displayed.
24. Locate the text User ld=BlueYonder;Password=Pa$$wOrd; in the connection string, and replace it with User ld=sa;Password=password@123; in the Web.config file.
25. Select FILE—Save All to save the changes.
26. Close Microsoft Visual Studio 2012.

Developing Windows Azure and Web Services Lab @ 3 Ans 2

Modify the BlueYonder.FlightDetails project to allow users to update the schedule departure of specific flight.



To implement the required functionality, you need to perform the following tasks:
1. Browse to the location where the Exercise 04.zip file is saved.
2. Extract the files.
3. Double-click the Exercise 04 folder.
4. Double-click the BlueYonder.Companion folder.
5. Double-click the BlueYonder.Companion.sin file. The BlueYonder.Companion - Microsoft Visual Studio window displayed.
6. Ensure that the Solution Explorer window is opened.
7. Ensure that the BlueYonder.FlightDetails node is expanded.
8. Double-click the Program.es file within the BlueYonder.FlightDetails node. The Program.es file is displayed.
9. Type the highlighted portions of the following code snippet in the Program.es file:
if (flightDetails != null)
{
Console.WriteLine("The flight starts from " + flightDetails.Source.City H ”, " + flightDetails.Source.Country + " for " + flightDetails.Destination.City + ”, " + flightDetails.Destination.Country +
}
else
{
Console.WriteLine("Invalid Flight Number.");
>
Console.WriteLine("\nDo you want to update the Flight Schedule? Enter Yes or
No");
string ans = Console.ReadLine(); if (ans.ToLower() == "yes")
{
Console.WriteLine("Enter the date in the MM/DD/YYYY format:"); string date = Console.ReadLine();
Console.WriteLine("Enter the time in the HH:MM:SS format:");
string time = Console.ReadLineQ;
string dateTime = date + " " + time;
foreach (var item in flightDetails.Schedules)
{
item.Departure = Convert.ToDateTime(dateTime)j bdbc .SaveChangesQi
}
Console.WriteLine("\nFlight Schedule is updated")$
}
Console.WriteLine("\nPress the ENTER key to close the application.") Console .ReadLineQ ;
10. Select FILE—Save All to save the changes
11. Select TEST—Windows—Test Explorer The Test Explorer window is displayed
12. Click Run All, and then wait for all the tests to complete.
13. Press the F5 key The output is displayed,
14. Enter a flight number, and then press the Enter key. The details of the specified flight is displayed.
15. Enter Yes. and then press the Enter key to update the flight schedule.
16. Enter the date in the specified format, and then press the Enter key.
17. Enter the time in the specified format, and then press the Enter key. The flight schedule is updated.
18. Press the Enter key to close the Console window.
19. Open SQL Server Management Studio, and connect to the ASQLExpress database server.
20. Expand the Databases node in the Object Explorer window, and then expand the BlueYonder.Companion.Lab02
database.
21. Expand the Tables nodes.
22. Right-click the FlightSchedules table, and then select Select Top 1000 Rows. The FlightSchedules table is displayed with updated record.
23. Close the SQL Server Management window.
24. Switch to Microsoft Visual Studio 2012, and close it.

Developing Windows Azure and Web Services Lab @ 3 Ans 1

Implement the functionality to query the source and destination information of a specific flight by providing the flight number. Start by creating a new Console application project, and use WhereQ extension method of LINQto Entities.



To implement the required functionality, you need to perform the following steps:
1. Browse to the location where you have saved the Exercise 03.zip file.
2. Extract the files.
3. Double-click the Exercise 03 folder.
4. Double-click the BlueYonder.Companion folder.
5. Double-click the BlueYonder.Companion.sin file. The BlueYonder.Companion - Microsoft Visual Studio window displayed.
6. Select FILE—Add—New Project The Add New Project window is displayed.
7. Ensure that the Installed—Visual C# nodes are expanded in the left pane.
8. Select the Windows node in the left pane.
9. Select the Console Application template in the middle pane.
10. Ensure that the framework selected for the project is .NET Framework 4.5
11. Select and replace the existing text in the Name text box with BlueYonder.FlightDetails
12. Click the OK button. The Program.es file is displayed.
13. Ensure that the Solution Explorer window is opened.
14. Right-click the BlueYonder.FlightDetails node, and then select Add Reference The Reference Manager -BlueYonder.FlightDetails dialog box is displayed.
15. Ensure that the Assemblies node is expanded in the left pane.
16. Ensure that the Framework option is selected in the left pane.
17. Type System.Data.Entity in the Search Assemblies combo box.
18. Select the System.Data.Entity option under the Name column in the middle pane.
19. Select the System.Data.Entity check box.
20. Select the Solution node in the left pane.
21. Select the BlueYonder.Entities option under the Name column in the middle pane.
22. Select the BlueYonder.Entities check box.
23. Click the OK button.
24 Right-click the BlueYonder.FlightDetails node, and then select Manage NuGet Packages The BlueYonder.FlightDetails - Manage NuGet Packages dialog box is displayed.
25. Type EntityFramework in the Search Online combo box.
26. Select the EntityFramework option in the middle pane.
27. Click the Install button. The Installing dialog box is displayed for few seconds and closed automatically.
28 Click the Close button to close BlueYonder.FlightDetails - Manage NuGet Packages dialog box.
29. Right-click the BlueYonder.FlightDetails node in the Solution Explorer window, and then select Set as Startup Project
30. Right-click the BlueYonder.FlightDetails node, and then select Add—Class The Add New Item -BlueYonder.FlightDetails dialog box is displayed.
31. Select and replace the existing text in the Name text box with BlueYonderDbContext
32. Click the Add button. The BlueYonderDbContext.es file is displayed.
33. Type the highlighted portions of the following code snippet in the BlueYonderDbContext.es file:
using System;
using System.Collections.Generic;
using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Data.Entity;
 using BlueYonder.Entities;

34. Type the highlighted portions of the following code snippet in the BlueYonderDbContext.es file:
class BlueYonderDbContext: DbContext
{
public BlueYonderDbContext()
 : base(@"Data
Source= Asqlexpress;Database=BlueYonder .Companion.Lab02integrated Security=True;")
{
}
public DbSet<Location> Locations { get; set; }
public DbSet<Flight> Flights { get; set; }
public DbSet<FlightSchedule> FlightSchedules { get; set; }
public DbSet<Traveler> Travelers { get; set; }
public DbSet<Reservation> Reservations { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<FlightSchedule>()
.HasRequired(fs => fs.Flight)
.WithMany(f => f.Schedules)
.Map(m => m.MapKeyC'FlightlD")); modelBuilder.Entity<Reservation>()
.HasRequired(r => r.DepartureFlight)
.WithManyQ
.HasForeignKey(r => r.DepartFlightSchedulelD); modelBuilder.Entity<Reservation>()
.HasOptional(r => r.ReturnFlight)
.WithManyQ
.HasForeignKey(r => r.ReturnFlightSchedulelD);
}
}
35. Ensure that the Solution Explorer window is opened
36. Double-click the Program.es file.
37. Type the highlighted portions of the following code snippet in the Program.es file:
static void Main(string[] args)
{
BlueYonderDbContext bdbc = new BlueYonderObContext() ;
 Console.WriteLine("Please enter the Flight Number:");
 string flightNumber = Console.ReadLine();
var flightDetails = bdbc.Flights.Where(f => f.FlightNumber == flightNumber) .FirstOrDefault();
if (flightDetails != null)
{
Console.WriteLine("The flight starts from " + flightDetails.Source.Ci ”, " + flightDetails.Source.Country + " for " + flightDetails.Destination.City + ", " flightDetails.Destination.Country + ".");
}
else
{
Console.WriteLine("Invalid Flight Number.");
}
Console.WriteLine("\nPress the ENTER key to close the application.") Console. ReadLineQ;
}
38. Select FILE—Save All to save the changes.
39. Press the F5 key to run the application. The Console window is displayed.
40. Type BY001 in the Console window, and then press the Enter key. The flight details is displayed.
41. Press the Enter key to close the application.
42. Close Microsoft Visual Studio 2012.
Console.WriteLine("Invalid Flight Number.");
}

Developing Windows Azure and Web Services Lab @ 2 Ans 3

Create tests for the Entity Framework data model by issuing queries, manipulating data, and using transactions to test multiple repositories at once.
The main tasks for this exercise are:
1. Add existing test project to solution.
2. Explore the existing integration test project.
3. Create queries by using LINQ to Entities.
4. Create queries by using Entity SQL and Raw SQL.
5. Create a test for manipulating data.
6. Create cross-repositories integration tests with System.Transactions.
7. Run the tests, and explore the database created by Entity framework.





To implement the required functionality, you need to perform the following tasks:
1. Add existing test project to solution.
2. Explore the existing integration test project.
3. Create queries by using LINQ to entities.
4. Create queries by using entity SQL and raw SQL.
5. Create a test for manipulating data.
6. Create cross-repositories integration tests with System.Transactions.
7. Run the tests, and explore the database created by entity framework.
Task 1: Adding Existing Test Project to Solution
1. Browse to the location where Exercise 02.zip file is saved.
2. Extract the files.
3. Double-click the Exercise 02 folder.
4. Double-click the BlueYonder.Companion folder.
5. Double-click the BlueYonder.Companion.sin file. The BlueYonder.Companion - Microsoft Visual Studio window displayed.
6. Ensure that the Solution Explorer window is opened.
7. Right-click the Solution 'BlueYonder.Companion' (3 projects) node, and then select Add—Existing Project. The Add Existing Project dialog box is displayed.
8. Double-click the BlueYonder.Companion folder.
9. Double-click the BlueYonder.IntegrationTests folder.
10. Select the BlueYonder.IntegrationTests.csproj file.
11. Click the Open button.

Task 2: Exploring the Existing Integration Test Project
1. Ensure that the Solution Explorer window is opened.
2. Ensure that the BlueYonder.IntegrationTests node is expanded.
3. Double-click the TravelCompanionDatabaselnitializer.es file. The TravelCompanionDatabaselnitializer.es file is displayed.
4. Explore the database initialization code in the Seed() method within the TravelCompanicnDatabaselnitializer class.
5. Double-click the FlightQueries.es file in the Solution Explorer window.
6. Explore the query test methods in the FlightQueries class. The Testlnitialize() static method is responsible for initializing the database and the test data, and all the other methods are intended to test various queries with lazy load and eager load.
7. Double-click the FlightActions.es file.The FlightActions.es file is displayed.
8. Explore the insert, update, and delete test methods in the FlightActions class. Observe the use of the Assert static class to verify the results of the test.

Task 3: Creating Queries by Using LINQ to Entities
1. Ensure that the Solution Explorer window is opened.
2. Ensure that the BlueYonder.IntegrationT ests node is expanded.
3. Double-click the ReservationQueries.es file. The ReservationQueries.es file is displayed.
4. Type the highlighted portions of the following code snippet inside the GetSingleReservaticn() test method:

4. Type the highlighted portions of the following code snippet inside the GetSingleReservation() test method:
[TestMethod]
public void GetSingleReservation()
{
using (var repository * new ReservationRepository())
{
var query = from r in repository.GetAll()
where r.ConfirmationCode == "1234” select r;
var reservation = query. FirstOrDefault();
Assert.IsNotNull(reservation);
>
5. Type the highlighted portions of the following code snippet inside the GetReservationWithFlightsEagerLoad() test method:
[TestMethod]
public void GetReservationWithFlightsEagerLoad()
{
Reservation reservation;
using (var repository = new ReservationRepository())
{
var query = from r in repository.GetAll()
where r.ConfirmationCode == "1234" select r;
query = query.Include(r => r.OepartureFlight).Include(r =>
r.ReturnFlight);
reservation = query.FirstOrDefauIt();
}
Assert.IsNotNul1(reservation);
Assert.IsNotNull(reservation.DepartureFlight);
Assert. IsNotNull(reservation.RetumFlight);
}

6. Type the highlighted portions of the following code snippet inside the GetReservationWithFlights LazyLoad() test method:
[TestMethod]
public void GetReservationWithFlightsLazyLoad()
{
Reservation reservation}
using (var repository = new ReservationRepository())
{
var query = from r in repository.GetAll()
where r.ConfirmationCode == "1234" select r;
reservation = query.FirstOrDefault();
Assert.IsNotNull(reservation)}
Assert.IsNotNull(reservation.DepartureFlight)}
Assert.IsNotNull(reservation.ReturnFlight)}
}
}

7. Type the highlighted portions of the following code snippet inside the Get ReservationWithSingleF light Failed LazyLoad () test method:
[TestMethod]
[ExpectedException(typeof(ObjectDisposedException))] public void GetReservationsWithSingleFlightFailedl_azyLoad() {
Reservation reservation;
using (var repository = new ReservationRepository())
{
var query = from r in repository.GetAll()
where r.ConfirmationCode == "1234" select r;
reservation = query.FirstOrDefault();
}
Assert.IsNotNull(reservation);
// We haven't eager loaded the departure flights,
// and the context is disposed, so lazy load will fail Assert.IsNotNull(reservation.DepartureFlight);
}
8. Select FILE—Save All to save the changes
Task 4: Creating Queries by Using Entity SQL and Raw SQL
1. Ensure that the Solution Explorer window is opened 2 Ensure that the ReservationQueries.es file is opened
3. Type the highlighted portions of the following code snippet inside theGetOrderedReservations() method:
[TestMethod]
public void GetOrderedReservations()
{
using (TravelCompanionContext context = new TravelCompanionContext())
{
ObjectQuery<Reservation> query =
((IObjectContextAdapter)context).ObjectContext.CreateQuery<Reservation>(
^"SELECT value r
FROM reservations as r
ORDER BY r.con-firmationCode DESC”);
List<Reservation> reservations = query.ToListQj Assert.AreEqual(reservations.Count, 2);
Assert.AreEqual(reservations[0]-ConfirmationCode, "4321");
Assert.AreEqual(reservations[l].ConfirmationCode, "1234");
}
}

4. Type the highlighted portions of the following code snippet inside theGetReservationsForDepartFlightsBySeatClass() method:
[TestMethod]
public void GetReservationsForDepartFlightsBySeatClass()
{
using (TravelCompanionContext context = new TravelCompanionContext())
{
IEnumerable<Reservation> query = context.Database.SqlQuery<Reservation>( @"select r.* from Reservations r
inner join Trips t on r.DepartFlightSchedulelD = t.TripId where t.Class = 2");
List<Reservation> flights = query.ToList();
Assert.AreEqual(flights.Count, 1)5
Assert.AreEqual(flights[0].ConfirmationCode, "1234");
}
}
5. Select FILE—Save All to save the changes

Task 5: Creating a Test for Manipulating Data
1. Ensure that the Solution Explorer window is opened
2 Ensure that the BlueYonder.IntegrationTests node is expanded
3. Double-click the FlightActions.es file. The FlightAetions.es file is displayed
4 Type the highlighted portions of the following code snippet inside the UpdateFlightQ method
[TestMethod]
public void UpdateFlight()
{
FlightRepository repository;
using (repository = new FlightRepositoryO)
{
Flight flight = repository.FindBy(f => f.FlightNumber ”BY002").Single();
flight.FlightNumber = "BY002_updated"; repository.Edit(flight); repository.Save();
}
using (repository = new FlightRepositoryO)
{
Flight flight = repository.FindBy(f => f.FlightNumber "BY002_updated").FirstOrDefault();
Assert.IsNotNull(flight);
}
}
5. Select FILE—Save All to save the changes
Task 6: Creating Cross-repositories Integration Tests with System.Transactions
1. Ensure that the Solution Explorer window is opened 2 Ensure that the FlightActions.es file is opened
3. Type the highlighted portions of the following code snippet inside the UpdateUsingTwoRepositories() method [TestMethod]
public void UpdateUsingTwoRepositories()
{
LocationRepository locationRepository = new LocationRepository(); FlightRepository flight Repository = new FlightRepository();
Flight flight, flightFromDbj Location location;
using (TransactionScope scope = nav TransactionScope())
{
// Update flight and location
flight = flightRepository.FindBy(f => f.FlightNuraber ==
"BY001") .Single();
flight.FlightNumber = "BY001_updated”i flightRepository.Edit(flight); flightRepository.Save();
location - locationRepository.FindBy(l => l.City == "Rome").SingleQj location.City = ”Rome_updated";
 locationRepository.Edit(location)j locationRepository.Save();
// Verify the flight and location were updated in the current transaction flightFromDb = (from f in flightRepository.GetAllQ
where f.Source.City == "Rome_updated'' select f).FirstOrDefault();
Assert.IsNotNull(flightFromDb);
Assert.AreEqual(flightFromDb.FlightNumber, "BY001_updated")j // Do not commit the transaction //scope.Complete();
}
// Transaction was rollbacked, so the flight
// and location did not get updated
flightFromDb = (from f in flightRepository.GetAll()
where f.Source.City == "Rome_updated"
select f).FirstOrDefault();
 Assert.IsNull(flightFromDb);
 locationRepository.Dispose();
 flightRepository.Dispose();

}
4. Select FILE—Save All to save the changes.

Task 7: Running the Tests and Exploring the Database Created by Entity Framework
1. Select Test—Windows—Test Explorer. The Test Explorer window is displayed.
2. Click Run All, and then wait for all the tests to complete.
3. Open the SQL Server Management Studio window.The Connect to Server dialog box is displayed.
4. Select and replace the text in the Server name text box with ASQLExpress
5. Select Windows Authentication from the Authentictaion drop-down list.
6. Click the Connect button.The Microsoft SQL Server Management Studio window is displayed.
7. Expand the Databases node in the Object Explorer window, and then expand the BlueYonder.Companion.Lab02 database.
8. Expand the Tables nodes
9. Notice that the Reservations and Trips tables are created.
10. Close the Microsoft SQL Server Management Studio window.
11. Switch to Microsoft Visual Studio 2012, and close it.

Developing Windows Azure and Web Services Lab @ 2 Ans 2

Create data model classes to represent trips and reservations, implement a DbContext-derived class, and create a new repository class for the Reservation entity.


To implement the required functionality, you need to perform the following tasks:
1. Explore the existing Entity framework data model project.
2. Create new data model classes.
3. Implement a data context by deriving from the Dbcontext class.
4. Create a new repository for the Reservation entity.
Task 1: Exploring the Existing Entity Framework Data Model Project
1. Browse to the location where Exercise 01 .zip file is saved.
2. Extract the files.
3. Double-click the Exercise 01 folder.
4. Double-click the BlueYonder.Companion folder.
5. Double-click the BlueYonder.Companion.sln file. The BlueYonder.Companion - Microsoft Visual Studio window displayed.
6. Ensure that the Solution Explorer window is opened.
7. Ensure that the BlueYonder.Entities node is expanded.
8. Double-click the FlightSchedule.es file. The FlightSchedule.es file is displayed.
9. Explore the properties of the FlightSchedule class. Explore how the DatabaseGenerated and ForeignKey attributes used in this class.
10. Ensure that the BlueYonder.DataAccess node is expanded in the Solution Explorer window.
11. Double-click the TravelCompanionContext.es file. The TravelCompanionContext.es file is displayed.
12. Explore the properties and methods of the TravelCompanionContext class. Explore the DbSet properties it contains.
13. Expand the Repositories node in the Solution Explorer window.
14. Double-click the FlightRepository.es file. The FlightRepository.es file is displayed.
15. Explore the methods of the FlightRepository class.

Task 2: Creating New Data Model Classes
1. Ensure that the Solution Explorer window is opened.
2. Right-click the BlueYonder.Entities node, and then select Add—Class. The Add New Item dialog box is displayed.
3. Select and replace the existing text in the Name text box with Trip.
4. Click the Add button. The Trip.cs file is displayed.
5. Type the highlighted portions of the following code snippet in the Trip.cs file: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel.DataAnnotations.Schema; using BlueYonder.Entities.Enums; namespace BlueYonder.Entities { public class Trip { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Tripld { get; set; } public int FlightSchedulelD { get; set; } [ForeignKey("FlightSchedulelD")] public virtual FlightSchedule Flightlnfo { get; set; } public FlightStatus Status { get; set; } public SeatClass Class { get; set; } > >
6. Select FILE— Save All to save the changes.
7. Ensure that the Solution Explorer window is opened.
8. Right-click the BlueYonder.Entities node, and then select Add—Class. The Add New Item - BlueYonder.Entities
dialog box is displayed.
9. Select and replace the existing text in the Name text box with Reservation.
10. Click the Add button. The Reservation.es file is displayed.
11. Type the highlighted portions of the following code snippet in the Reservation.es file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
namespace BlueYonder.Entities
{
public class Reservation
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Reservations { get; set; } public int Travelerld { get; set; ) public DateTime ReservationDate { get; set; } public string ConfirmationCode { get; set; } public int DepartFlightSchedulelD { get; set; > public virtual Trip DepartureFlight { get; set; } public int? ReturnFlightSchedulelD { get; set; } public virtual Trip ReturnFlight { get; set; }
>
>
12. Select FILE—Save All to save the changes.

Task 3: Implementing a Data Context by Deriving from the DbContext Class
1. Ensure that the Solution Explorer window is opened.
2. Ensure that the BlueYonder.DataAccess node is expanded.
3. Double-click the TravelCompanionContext.es file. The TravelCompanionContext.es file is displayed.
4. Type the highlighted portion of the following code snippet in the TravelCompanionContext.es file:
public class TravelCompanionContext : DbContext
{
public DbSet<Location> Locations { get; set; }
public DbSet<Flight> Flights { get; set; }
public DbSet<FlightSchedule> FlightSchedules { get; set; }
public DbSet<Traveler> Travelers { get; set; }
public DbSet<Reservation> Reservations { get; set; }
5. Type the highlighted portions of the following code snippet inside the OnMcdelCreating() method:
protected override void 0nModelCreating(DbModel6uilder modelBuilder)
{
modelBuilder.Entity<FlightSchedule>()
.HasRequired(fs => fs.Flight)
.WithMany(f => f.Schedules)
.Map(m => m.MapKey("FlightID")); modelBuilder.Entity<Reservation>()
.HasRequired(r => r.DepartureFlight)
.WithMany()
.HasForeignKey(r => r.DepartFlightSchedulelD)j modelBuilder.Entity<Reservation>()
.HasOptional(r => r.ReturnFlight)
.WithMany()
.HasForeignKey(r => r.ReturnFlightSchedulelD)j
}
6. Select FILE— Save All to save the changes.
Task 4: Creating a New Repository for the Reservation Entity
1. Ensure that the Solution Explorer window is opened.
2. Ensure that the BlueYonder.DataAccess node is expanded.
3. Right-click the Repositories folder, and then select Add—Class. The Add New Item - BlueYonder.Access dialog box displayed.
4. Select and replace the existing text in the Name text box with ReservationRepository.
5. Click the Add button. The ReservationRepository.es file is displayed.
6. Type the highlighted portions of the following code snippet in the ReservationRepository.es file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.Linq.Expressions;
using BlueYonder.DataAccess.Interfaces;
using BlueYonder.Entities;
namespace BlueYonder.DataAccess.Repositories
{
public class ReservationRepository : ISingleKeyEntityRepository<Reservation, int>
{
}
}
7. Type the highlighted portions of the following code snippet inside the ReservationRepository class:

public class ReservationRepository : ISingleKeyEntityRepository<Reservation, int>
{
TravelCompanionContext context} public ReservationRepository()
{
context = new TravelCompanionContext()}
}
public ReservationRepository(string connectionName)
{
context = new TravelCompanionContext(connectionName)}
}
public ReservationRepository(TravelCompanionContext dbContext)
{
context = dbContext}
}
public Reservation GetSingle(int entityKey)
{
var query = from r in context.Reservations
where r.Reservationld == entityKey select r}
return query.SingleOrOefault()}
}
public void Delete(Reservation entity)
{
entity =
context.Reservations.Find(entity.Reservationld)} if (entity.DepartFlightSchedulelD != 0)
context.Entry(entity.DepartureFlight).State = System.Data.EntityState.Deleted}
if (entity.ReturnFlightSchedulelD != 0)
context.Entry(entity.ReturnFlight).State = System.Data.EntityState.Deleted;
context.Reservations.Remove(entity);
}
public void Dispose()
{
if (context != null)
{
context.Di spose()j context = null;
}
GC.SuppressFinalize(this);
}
public IQueryable<Reservation> GetAllQ
{
return context.Reservations.AsQueryable<Reservation>();
}
public IQueryable<Reservation> FindBy(Expression<Func<Reservation, bool» predicate)
{
return GetAllQ .Where(predicate);
}
public void Add(Reservation entity)
{
context.Reservations.Add(entity);
}
public void Edit(Reservation entity)
{
var originalEntity = context.Reservations.Find(entity.Reservationld); context.Entry(originalEntity).CurrentValues.SetValues(entity);
}
public void SaveQ
{
context.SaveChanges();
}
}
8. Select FILE—Save All to save the changes.
9. Close Microsoft Visual Studio 2012.

Developing Windows Azure and Web Services Lab @ 2 Ans 1

In this exercise, you will learn to host products on the Windows Azure cloud by using Windows Azure SQL Database and Windows Azure Web Site.



To host products on the Windows Azure cloud by using Windows Azure SQL Database and Windows Azure Web Site, you need to perform the following steps:
1. Login into the Windows Azure account to access the Windows Azure Management Portal at https://manage.windowsazure.com.
2. Click WEB SITES in the navigation pane.
NEW
3. Click the NEW button.
4. Click QUICK CREATE.
5. Type BlueYonderLocations in the URL text box.
6. Select specific region from the REGION drop-down list.
7. Click the CREATE WEB SITE link, and wait until the Web Site is created and its status changes to Running.
8. Click the name of the new Web Site.
9. Click the DASHBOARD link.
10. Click the Download the publish profile link under the quick glance section on the right side. At the bottom of the Internet Explorer window, a prompt appears.
11. Click the arrow within the Save button.
12. Select the Save as option. The Save As dialog box is displayed.
13. Browse to the location where you want to save the publish profile.
14. Click the Save button.
15. Open Computer windows by pressing the Windows logo and E keys together.
16. Browse to the location where you have saved the Exercise 04.zip file.
17. Extract the Exercise 04.zip file.
18. Double-click the Exercise 04 folder.
19. Double-click the BlueYonder.Model folder.
20. Double-click the BlueYonder.Model.sin file. The BlueYonder.Model - Microsoft Visual Studio windows is displayed.
21. Ensure that the Solution Explorer window is opened.
22. Right-click the BlueYonder.MVC project, and then select Publish from the context menu. The Publish web application page of the Publish Web wizard is displayed.
23. Click the Import button. The Import Publish Settings dialog box is displayed.
24. Browse to the location where you have saved the publish settings.
25. Select the publish settings file.
26. Click the Open button.
27. Click the Publish button. Microsoft Visual Studio 2012 builds and publishes the application. Further. Microsoft Visual Studio 2012 opens Internet Explorer and browses to the Web Site after the deployment finishes.
28. Append api/locations to the address in the address bar. and then press the Enter key. At the bottom of the Internet Explorer window, a prompt appears.
29. Click the Open button.
30. Select Notepad from the list of available programs, if you are prompted to select a program to open the file. When Notepad opens, you should see a list of Location entities, encoded with the JSON format.
31. Close Notepad.
32. Switch to the Internet Explorer window in which Windows Azure Management Portal is opened.
33. Click SQL DATABASES in the navigation pane on the left side. The sql databases page is displayed.
34. Click the SERVERS link.
35. Click the STATUS column.
36. Click the DELETE button in the bottom pane. The DELETE SERVER CONFIRMATION dialog box is displayed. Type the name of the server in the CONFIRM SERVER NAME text box.
37. Click the OK (I_______ button. The database server is deleted.
38. Click the user icon in the upper-right corner of the Windows Azure page. A context menu is displayed. Select Sign out.
39. Close the Internet Explorer window.
Note: If Internet Explorer message box is displayed, click the Close all tabs button.
40. Switch to Microsoft Visual Studio 2012.
41. Close Microsoft Visual Studio 2012.

Developing Windows Azure and Web Services Lab @ 1 Ans 4

In this exercise, you will create a website that exposes the Web API for Create. Retrieve. Update. Delete (CRUD) operations on the BlueYonder database.


To implement the required functionality, you need to perform the following tasks:
1. Browse to the location where you have saved the Exercise 03.zip file.
2. Extract the Exercise 03.zip file.
3. Double-click the Exercise 03 folder.
4. Double-click the BlueYonder.Model folder.
5. Double-click the BlueYonder.Model.sin file. The BlueYonder.Model - Microsoft Visual Studio window is displayed.
6. Ensure that the Solution Explorer window is opened.
7. Right-click the Solution 'BlueYonder.Model' (1 project) node, and then select Add->New Project option from the context menu. The Add New Project dialog box is displayed.
8. Ensure that the Visual C# node is expanded under the Installed node in the left pane.
9. Select Web under the Visual C# node.
10. Select ASP.NET MVC 4 Web Application from the list of templates in the middle pane.
11. Select and replace the text in the Name text box with BlueYonder.MVC.
12. Click the OK button. The NewASP.NET MVC 4 Project dialog box is displayed.
13. Select the Web API template.
14. Click the OK button. The ValuesController.es file is displayed in the BlueYonder.Model - Microsoft Visual Studio
window.
15. Right-click the BlueYonder.MVC project in the Solution Explorer window, and then select Add Reference. The Reference Manager - BlueYonder.MVC dialog box is displayed.
16. Click the Solution node in the left pane.
17. Select the BlueYonder.Model check box in the middle pane.
18. Click the OK button.
19. Double-click the App.config file of the BlueYonder.Model project.
20. Locate the connectionStrings> section, and then select the <add> element, including its attributes.
21. Press the Ctrl+C keys to copy the element to the clipboard.
22. Double-click the Web.config file of the BlueYonder.MVC project.
23. Locate the connection Strings> section.
24. Place the cursor after the connection Strings> tag. and then press the Ctrl+V keys to paste the connection string.
Note: Ensure that you replace the name of the database server in the connection string with the name of the recently created database server on Windows Azure Management Portal.
25. Press the Ctrl+S keys to save the changes.
26. Select BUILD—Build Solution.
27. Select VIEW—Server Explorer.
28. Right-click the Data Connections node, and then select the Refresh option from the context menu.
29. Expand the Data Connections node. The BlueYonderEntities (BlueYonder.MVC) node is displayed under the Data Connections node.
30. Right-click the Controllers node of the BlueYonder.MVC project, and then select Add—Controller. The Add Controller
dialog box is displayed.
31. Select and replace the text in the Controller name text box with LocationsController.
32. Select the API controller with read/write actions, using Entity Framework option from the Template drop-down list.
33. Select Location (BlueYonder.Model) from the Model class combo box.
34. Select BlueYonderEntities (BlueYonder.Model) from the Data context class combo box.
35. Click the Add button.
36. Right-click the BlueYonder.MVC project, and then select the Set as Startup Project option from the context menu.
37. Press the Ctrl+F5 keys. The Internet Explorer window is displayed.
38. Append api/locations to the address in the address bar. and then press the Enter key. At the bottom of the Internet Explorer window, a prompt appears.
39. Click the Open button.
40. Select Notepad from the list of available programs if you are prompted to select a program to open the file. When Notepad opens, you should see a list of Location entities, encoded with the JavaScript Object Notation (JSON) format.
41. Close Notepad
42. Close the Internet Explorer window.
43. Switch to Microsoft Visual Studio 2012.
44. Close Microsoft Visual Studio 2012.

Developing Windows Azure and Web Services Lab @ 1 Ans 3

In this exercise, you have to create Entity Framework wrappers for the Blue Yonder database.



To implement the required functionality, you need to perform the following steps:
1. Press the Windows logo key. The Start screen is displayed.
2. Start hyping Visual Studio 2012. The Search and Apps panes are displayed.
3. Click the Visual Studio 2012 tile in the Apps pane. The Choose Default Environment Settings dialog box is displayed.
4. Select Visual C# Development Settings in the Choose your default environment settings list box.
5. Click the Start Visual Studio button. The Microsoft Visual Studio splash screen is displayed for a while. Then, the Start Page - Microsoft Visual Studio window is displayed.
Note: If Help Content Manager dialog box is displayed, click the Yes button.
6. Select FILE—New—Project. The New Project dialog box is displayed.
7. Ensure that the Installed—Templates—Visual C# nodes are expanded in the navigation pane.
8. Select the Windows node.
9. Select Class Library from the list of templates in the middle pane.
10. Select and replace the existing text in the Name text box with BlueYonder.Model.
11. Select and replace the existing text in the Location drop-down list with D:\Exercises\Module_01\Exercise_02.
12. Ensure that the Create directory for solution check box is selected.
13. Click the OK button. The Classl .cs file is displayed in the BlueYonder.Model - Microsoft Visual Studio window.
14. Ensure that the Solution Explorer window is open.
15. Right-click the Classl.cs file, and then select Delete from the context menu. The Microsoft Visual Studio message box is displayed.
16. Click the OK button.
17. Right-click the BlueYonder.Model node in the Solution Explorer window, and then select Add—New Item. The Add New Item - BlueYonder.Model dialog box is displayed.
18. Ensure that the Installed—Visual C# Items nodes are expanded in the left pane.
19. Select the Data node from the left pane.
20. Select ADO.NET Entity Data Model from the list of templates available in the middle pane.
21. Select and replace the existing text in the Name text box with EntityModel.
22. Click the Add button. The Choose Model Contents page of the Entity Data Model Wizard is displayed.
23. Ensure that the Generate from database option is selected under the What should the model contain section.
24. Click the Next button. The Choose Your Data Connection page is displayed.
25. Click the New Connection button. The Choose Data Source dialog box is displayed.
26. Select the Microsoft SQL Server option from the Data source list box.
27. Ensure that the Always use this selection check box is selected.
28. Click the Continue button.
29. Type SQLServerName.database.windows.net (replace SQLServerName with your server name) in the Server name text box.
30. Select the Use SQL Server Authentication option.
31. Type SQLAdmin in the User name text box.
32. Type PaSSwOrd in the Password text box.
33. Select the Save my password check box.
34. Click the Test Connection button. The Microsoft Visual Studio message box is displayed.
35. Click the OK button.
36. Select BlueYonder from the Select or enter a database name drop-down list.
37. Click the OK button. The Choose Your Data Connection page of the Entity Data Model Wizard is displayed.
38. Select the Yes. include the sensitive data in the connection string option.
39. Click the Next button. The Choose Your Database Objects and Settings page is displayed.
40. Expand the Tables—dbo nodes.
41. Select the Locations and Travelers check boxes.
42. Click the Finish button. The Security Warning dialog box is displayed.
43. Selec the Do not show this message again check box.
44. Click the OK button. The EntityModel.edmx file is displayed.
45. Select FILE-Save All.
46. Close the BlueYonder.Model - Microsoft Visual Studio window.

Developing Windows Azure and Web Services Lab @ 1 Ans 2

In this exercise, you have to use Windows Azure Management Portal and create a new Windows Azure SQL Server. You need to connect the new SQL server with SQL Server Management Studio and create a Blue Yonder database from the .bacpac file.



To create a new Windows Azure SQL Server, you need to perform the following steps:

1.Open Internet Explorer.
2.Type https://manage.windowsazure.com in the address bar. and press the Enter key.
3.Enter your email and password in the respective text boxes on the Sign In page.
4.Click the Sign In button. The Windows Azure page is displayed.
5.Click SQL DATABASES in the navigation pane available on the left side. The sql databases page is displayed.
6.Click SERVERS in the top-left corner of the sql databases page.
7.Click the Add displayed, as shown in the following figure.
button at the bottom of the page. The SQL database server settings dialog box
8. Type SQLAdmin in the LOGIN NAME text box.
9. Type PaSSwOrd in the LOGIN PASSWORD and CONFIRM PASSWORD text boxes.
10. Select Southeast Asia from the REGION drop-dov/n list.
11. Click the Complete (right arrow) button.
12. Wait for the server to appear in the list of servers and its status changed to Started.
13. Note the name of the ser/er.
14. Click the name of the newly created server.
15. Click the CONFIGURE tab.
16. Add a new firewall rule by filling the following information in the allowed ip addresses section:
o RULE NAME: OpenAIIIPs
o START IP ADDRESS: 0.0.0.0
o END IP ADDRESS: 255.255.255.255
17. Click the Save SAVE button in the bottom.

18.Press the Windows logo key. The Start screen is displayed.
19.Start typing SQL Server Management Studio. The Search and Apps panes are displayed.
20.Click the SQL Server Management Studio tile. The Connect to Server dialog box is displayed.
21.Type SQLServerName.database.windows.net (replace SQLServerName with the name of the newly created server on Windows Azure).
22.Select SQL Server Authentication from the Authentication drop-down list.
23.Type SQLAdmin in the Login text box.
24.Type PaSSwOrd in the Password text box.
25.Click the Connect button. The Microsoft SQL Server Management Studio window is displayed.
26.Right-click the Databases node in the Object Explorer window, and then select the Import Data-tier Application option from the context menu. The Introduction page of the Import Data-tier Application wizard is displayed.
27.Click the Next button. The Import Settings page is displayed.
28.Ensure that the Import from local disk option is selected.
29.Click the Browse button. The Open dialog box is displayed.
30.Browse to the location where BlueYonder.bacpac file is saved.
31.Select the BlueYonder.bacpac file.
32.Click the Open button.
33.Click the Next button.
34.Click the Next button.
35.Click the Finish button, and wait until the database import procedure is finished.
36.Click the Close button.
37.Press F5 to refresh the database list.
38.Expand the Databases node, and verify that the BlueYonder database is added.
39.Close the Microsoft SQL Server Management Studio window.
40.Switch to the Internet Explorer window.
41.Click the user icon in the upper-right corner of the Windows Azure page. A context menu is displayed.
42.Select Sign out.
43.Close the Internet Explorer window.

Developing Windows Azure and Web Services Lab @ 1 Ans 1

Exploring the Windows Azure Management Portal



1. Open Internet Explorer.
2. Type https://manage.wmdowsazure.com in the address bar. and then press the Enter key. The page to sign in to the Windows Azure account is displayed.
3. Enter your email (live account), such as myliveaccount@Iive.com. in the user name text box.
4. Enter the password in the password text box.
5.      Click the Sign in button. The Windows Azure page is displayed

The Windows Azure page contains various options in the navigation pane. These options can be used to avail different types of services provided on the Windows Azure Management Portal.

The commonly-used services of the Windows Azure Management Portal are:
¦ WEB SITES: Offers options for secure and flexible development, deployment, and scaling of Web applications. In addition, it leverages the existing tools to create and deploy cloud applications without the difficulty of managing infrastructure.
¦ VIRTUAL MACHINES: Enables you to deliver on-demand, scalable computing infrastructure to meet the growing business needs. It allows you to create Windows Server and Linux operating systems environments in multiple configurations on top of the Windows Azure foundation.
¦ MOBILE SERVICES: Enables you to create a scalable and secure backend for the Windows. Android, and iOS apps. By using MOBILE SERVICES, you can:

• Store data in cloud by using various Windows Azure cloud storage techniques, such as Windows Azure Structured Query Language (SQL) database, blob storage, and table storage.
database, blob storage, and table storage.
Authenticate users easily.
Send push notifications to the apps running on Windows. Android, and iOS devices.

CLOUD SERVICES: Enables you to create liighly-available and substantially-scalable applications and Application Programming Interfaces (APIs). This service allows you to focus on the functionality of the application and not on the infrastructure required to run the application.

SQL DATABASES: Is fully managed relational database service that allows you to create and manage Windows Azure SQL database servers.

STORAGE: Allows your applications to access Windows Azure Blob. Table, and Queue services to store data. You need a separate storage account to use Windows Azure storage for your applications.

SQL REPORTING: Enables you to create reports with tables, charts, and maps and deploy the reports on both private and public clouds.

MEDIA SERVICES: Provide a range of inbuilt, ready-to-use. first and third-party components that can be combined to meet specific media distribution requirements. It provides various capabilities, such as upload, storage, encoding, format conversion, content protection, and delivery, which can be used to distribute media to global audience. Therefore. Windows Azure MEDIA SERVICES allow you to easily create, manage, and deliver media across multiple devices.

SERVICE BUS: Provides the messaging channel for connecting the cloud applications to on-premises applications, services, and systems. You can use SERVICE BUS to manage message delivery in the cloud, connect on-premises applications to the cloud, and send push notifications to mobile devices.

ACTIVE DIRECTORY: Provides identity management and access control capabilities for the cloud applications. It provides a cloud-based identity provider that can easily integrate with the on-premises Active Directory (AD) deployments. In addition, it provides full support for third party identity providers.

NETWORKS: Enables you to create a logically isolated network in Windows Azure. Further, it allows you to securely connect this network to on-premises datacenter or to a single client machine using an Internet Protocol Security (IPsec) connection. In addition, it allows you to:
Easily extend your datacenter using Windows Azure.
Build distributed applications.
Debug your applications remotely.

TRAFFIC MANAGER: Allows you to manage incoming traffic across multiple hosted Windows Azure services so that you can ensure high performance and availability of your applications. It enables you to select from three load balancing methods: performance, failover, and round robin. Therefore, by configuring TRAFFIC MANAGER, you can run responsive applications and ensure high availability for your applications.

ADD-ONS: Enables you to quickly discover and purchase application and data services from Microsoft partners. Further, it allows you to manage the services purchased from Windows Azure Store through Windows Azure Management Portal.

MANAGEMENT SERVICES: Enables you to manage the alerts and operations logs for the current subscription.

SETTINGS: Enables you to configure settings related to management certificates, subscriptions, and affinity groups. For example, it allows you to add. edit, or remove subscriptions of a user from the Windows Azure account.