Tuesday, 3 December 2013

History of MVC Framework

A brief history of Asp.Net MVC framework

Asp.Net MVC is a new Framework built on the top of Microsoft .Net Framework to develop web application. This framework implements the MVC pattern which helps to provides separation of code and also provide better support for test-driven development (TDD).
Asp.Net MVC is a lightweight and highly testable open source framework for building highly scalable and well designed web applications. Here is the list of released version history of ASP.NET MVC Framework with theirs features.

Asp.Net MVC1

  1. Released on Mar 13, 2009
  2. Runs on .Net 3.5 and with Visual Studio 2008 & Visual Studio 2008 SP1
  3. MVC Pattern architecture with WebForm Engine
  4. Html Helpers
  5. Ajax helpers
  6. Routing
  7. Unit Testing

Asp.Net MVC2

  1. Released on Mar 10, 2010
  2. Runs on .Net 3.5, 4.0 and with Visual Studio 2008 & 2010
  3. Strongly typed HTML helpers means lambda expression based Html Helpers
  4. Templated Helpers
  5. Support for Data Annotations Attribute
  6. Client-side validation
  7. UI helpers with automatic scaffolding & customizable templates
  8. Attribute-based model validation on both client and server
  9. Overriding the HTTP Method Verb including GET, PUT, POST, and DELETE
  10. Areas for partitioning a large applications into modules
  11. Asynchronous controllers

Asp.Net MVC3

  1. Released on Jan 13, 2011
  2. Runs on .Net 4.0 and with Visual Studio 2010
  3. The Razor view engine
  4. Improved Support for Data Annotations
  5. Remote Validation
  6. Compare Attribute
  7. Sessionless Controller
  8. Child Action Output Caching
  9. Dependency Resolver
  10. Entity Framework Code First support
  11. Partial-page output caching
  12. ViewBag dynamic property for passing data from controller to view
  13. Global Action Filters
  14. Better JavaScript support with unobtrusive JavaScript, jQuery Validation, and JSON binding
  15. Use of NuGet to deliver software and manage dependencies throughout the platform
  16. Good Intellisense support for Razor into Visual Studio

Asp.Net MVC4

  1. Released on Aug 15, 2012
  2. Runs on .Net 4.0, 4.5 and with Visual Studio 2010SP1 & Visual Studio 2012
  3. ASP.NET Web API
  4. Enhancements to default project templates
  5. Mobile project template using jQuery Mobile
  6. Display Modes
  7. Task support for Asynchronous Controllers
  8. Bundling and minification
  9. Support for the Windows Azure SDK

Asp.Net MVC5 Preview

  1. Released on Jun 26, 2013
  2. Runs on .Net 4.5, 4.5.1 and with Visual Studio 2013 Preview
  3. One Asp.Net
  4. Asp.Net Identity
  5. ASP.NET Scaffolding
  6. Authentication filters - run prior to authorization filters in the ASP.NET MVC pipeline
  7. Bootstrap in the MVC template
  8. ASP.NET Web API2

Difference Between Http Services

Difference between WCF and Web API and WCF REST and Web Service

The .Net framework has a number of technologies that allow you to create HTTP services such as Web Service, WCF and now Web API. There are a lot of articles over the internet which may describe to whom you should use. Now a days, you have a lot of choices to build HTTP services on .NET framework. In this article, I would like to share my opinion with you over Web Service, WCF and now Web API. For more information about Web API refers What is Web API and why to use it ?.

Web Service

  1. It is based on SOAP and return data in XML form.
  2. It support only HTTP protocol.
  3. It is not open source but can be consumed by any client that understands xml.
  4. It can be hosted only on IIS.

WCF

  1. It is also based on SOAP and return data in XML form.
  2. It is the evolution of the web service(ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ.
  3. The main issue with WCF is, its tedious and extensive configuration.
  4. It is not open source but can be consumed by any client that understands xml.
  5. It can be hosted with in the applicaion or on IIS or using window service.

WCF Rest

  1. To use WCF as WCF Rest service you have to enable webHttpBindings.
  2. It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
  3. To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files
  4. Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
  5. It support XML, JSON and ATOM data format.

Web API

  1. This is the new framework for building HTTP services with easy and simple way.
  2. Web API is open source an ideal platform for building REST-ful services over the .NET Framework.
  3. Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
  4. It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
  5. It can be hosted with in the application or on IIS.
  6. It is light weight architecture and good for devices which have limited bandwidth like smart phones.
  7. Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.

To whom choose between WCF or WEB API

  1. Choose WCF when you want to create a service that should support special scenarios such as one way messaging, message queues, duplex communication etc.
  2. Choose WCF when you want to create a service that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transport channels are unavailable.
  3. Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
  4. Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iphone and tablets.

Choosing which technology to use

The following table describes the major features of each technology.

 

WCFASP.NET Web API
Enables building services that support multiple transport protocols (HTTP, TCP, UDP, and custom transports) and allows switching between them.
HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach.
Enables building services that support multiple encodings (Text, MTOM, and Binary) of the same message type and allows switching between them.
Enables building Web APIs that support wide variety of media types including XML, JSON etc.
Supports building services with WS-* standards like Reliable Messaging, Transactions, Message Security.
Uses basic protocol and formats such as HTTP, WebSockets, SSL, JQuery, JSON, and XML. There is no support for higher level protocols such as Reliable Messaging or Transactions.
Supports Request-Reply, One Way, and Duplex message exchange patterns.
HTTP is request/response but additional patterns can be supported throughSignalRand WebSockets integration.
WCF SOAP services can be described in WSDL allowing automated tools to generate client proxies even for services with complex schemas.
There is a variety of ways to describe a Web API ranging from auto-generated HTML help page describing snippets to structured metadata for OData integrated APIs.
Ships with the .NET framework.
Ships with .NET framework but is open-source and is also available out-of-band as independent download.
Use WCF to create reliable, secure web services that accessible over a variety of transports. Use ASP.NET Web API to create HTTP-based services that are accessible from a wide variety of clients. Use ASP.NET Web API if you are creating and designing new REST-style services. Although WCF provides some support for writing REST-style services, the support for REST in ASP.NET Web API is more complete and all future REST feature improvements will be made in ASP.NET Web API. If you have an existing WCF service and you want to expose additional REST endpoints, use WCF and the WebHttpBinding.