Thursday, July 24, 2014

Passed exam 70-486 : Developing ASP.NET MVC Web Applications

I passed exam 70-486: Developing ASP.NET MVC Web Applications two weeks ago, "al 7amd lellah", I am now preparing for Exam 70-487: Developing Windows Azure and Web Services.

ASP.NET Web API - Part 1

Two years ago (Aug 2012), my college Jonathan Kyle and I represented ASP.NET Web API at the ASP.NET Atlanta User Group, then we wrote a blog that never posted, and as I am reading again in the web services and the updates in the Web API I think I can start by posting the blog as the concept  is still the same, then write about the new features.

The first post of the series is written by Jonathan, and here it is:

Introduction:

Everything now became connected together in a way that it became so difficult to say that we have this set of communication languages or communication formats for any conversation including the question or the answer. It is also difficult to let the person you are communicating with just answer your question without adding more details unless you asked him for, and if you need more details do you want it as a text, diagram or a map or whatever? This is why there is always a need for a standard way to communicate, standard way to ask and a standard way to answer, and it is very important to have this communication method very simple to be able to communicate with anyone who has the minimum level or understanding. This is why ASP.NET WEB API is here.


What is ASP.NET Web API

A multi-tier application development platform built on top of the .NET Framework for building and consuming HTTP services that can reach a broad range of clients.  It incorporates the best from WCF Web API and the best from ASP.NET MVC.
.NET and HTTP Services Timeline

Microsoft has arrived at the ASP.NET Web API after several evolutions of web technologies, and applying the lessons learned along the way.

  • 2002: ASP.NET ASMX Services
  • 2006: .NET 3 – WCF Services (SOAP + WS-* Stateful)
  • 2007: .NET 3.5 – WCF WebHttpBinding (first attempt)
  • 2009: WCF - REST Starter Kit (separate package)
  • 2010: .NET 4/WCF - REST Starter Kit + HTTP Services
  • 2012: Merged into ASP.NET MVC Framework called “Web API”


Feature Highlights

  • Modern HTTP programming model: HTTP capable application / client such as a web browser, ajax, or HttpClient.
  • Full support for ASP.NET Routing:  Uses the HTTP method to determine which action is performed by the web application.
  • Content negotiation and custom formatters: Supports automatically converting objects from the server into the data format requested by the client such as JSON and XML.
  • Model binding and validation: Supports automatically converting and validating data from the client into objects on the server.
  • Filters and Query composition: Easily support OData and query syntax.
  • Easy to unit test: Uses MVC pattern makes an application that can have actions tested in isolation from other bits of code.
  • Improved Inversion of Control (IoC) via DependencyResolver: Uses application configuration to automatically find dependent resources for an action.
  • Code-based configuration:  Application can be configured programmatically, not just by application configuration.
  • Flexible Hosting: fully supports Self Host, IIS and Windows Azure.

Why ASP.NET Web API


ASP.NET Web API is the ideal platform for building RESTful application on the .NET Framework.  It is a pattern which enables an application to publish an entity as a Uniform Resource Identifier (URI), typically classified as a Uniform Resource Locator (URL) that is accessible using the HTTP protocol.
The application level protocol (HTTP method) such as GET, PUT, POST, and DELETE specifies the operation that is performed with the entity.  Metadata describing a message is described by the header information built into the HTTP protocol, for example:

  • The body of a message meets the criteria specified in the header such as a description of an entity in a specific format (XML, JSON, etc).
  • Entity contained in the body can be hypermedia (links to other resources)
  • A response message may be a cached response that a proxy server can use as a response without ever passing the request to a server.

ASP.NET Web API uses the elegant MVC infrastructure, allowing the utilization of the HTTP protocol with the minimum amount of coding, and enables the application developer to focus on the business specific application implementation.

Although ASP.NET Web API is an improvement over REST API in WCF by not needing the plumbing complexity, WCF may still be better for messaging and duplex communication, such as using MSMQ or TCP.

Blessings of working on large real-world projects

Working on large real-world projects can offer numerous blessings and benefits, both professionally and personally. Here are some of the key...