Tuesday, February 25, 2014

Codeproject: MVC 5 New Features

Codeproject: MVC 5 New Features

highlights from http://www.codeproject.com/Articles/728216/ASP-NET-MVC-5-New-Features

Find out about   Attribute based routing,, 

blah blah blah....

Attribute based routing in MVC 5


This is where attribute based routing comes in. Using attribute based routing we can define the route in the same place where action method is defined. Following is an example of a route defined using the Route attribute. As you can see the route is directly attached to the action method.
  [Route("Products/Electronics/{id}")]
       public ActionResult GetElectronicItems(string id)
       {
           ViewBag.Id = id;
            return View();
       }     
To enable attribute based routing we need to add the following in the RouteConfig file.
 public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapMvcAttributeRoutes();
        }  
So now we have attached the Route attribute to our action method our action method will be able to handle the requests which matches the URL pattern defined by the Route attribute.


....

Filter's in MVC

Filters in MVC provide us with an elegant way to implement cross cutting concerns.Cross cutting concerns is the functionality that is used across our application in different layers.Common example of such functionality includes caching ,exception handling and logging.

Cross cutting concerns should be centralized in one location instead of being scattered and duplicated across the entire application.This makes updating such functionality very easy as it is centralized in one location. Filters provide this advantage as they are used to implement cross cutting concerns using a common logic that can be applied to different action methods and controllers.Filters are implemented as classes that contains code that is executed either before the action method is executed or after the action method executes. We can create global or controller filters in MVC 4.Global filters are filters that are applied to all the action methods in the application while controller filters apply to all the action methods in the controller. We can create a global filter by creating a class and registering it as a global filter...

ASP.NET IDENTITY 

Some of the main features of ASP.NET Identity are 
  • It can be used by any ASP.NET framework such as ASP.NET MVC and WebForms.
  • We can easily add third party party authentication providers like google , facebook 
  • We have control of the persistence storage.So we can now store the credentials not only in 
  • the SQL Server database but can also use other persistence  storages like Azure and NoSQL databases. 

Using third party authentication providers the task of authenticating the users can be delegated to a third party site such as google. There are numerous sites that supports openID protocol such as google. With MVC 5 we can use it as part of a newly created project  .....



you can thank this fellow:

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ashish__Shukla
Technical Lead 
India India
I have a keen interest in technology and software development.I have worked in C#,ASP.NET WebForms,MVC,HTML5 and SQL Server.I try to keep myself updated and learn and implement new technologies.
Please vote if you like my article ,also I would appreciate your suggestions.
Please use the following for more information code-compiled

No comments:

Post a Comment