TechBubbles Microsoft Technology BLOG

ASP.NET MVC 6 overview

ASP.NET MVC 6 is a single aligned web stack on top of ASP.NET for doing web UI and web API. The current web stack contains Web Pages, MVC and Web API as shown in the following picture, they do not share much, Web pages and MVC share razor view engine but beyond that they do not share much example html helpers. Both MVC and Web API have their own Controllers, Actions, Filters and Model bindings

image

MVC and Web API actually share zero code. MVC has system.web dependency where as Web API do not and can run outside IIS.

What is ASP.NET MVC 6?

image

select the ASP.NET 5 Starter Web template for creating new ASP.NET MVC 6 application then you are ready to go!

image

if you do not see the ASP.NET MVC package in project.json file then you can add it to the file

image

You can open the solution explorer to see the core references and their dependencies

image

ASP.NET MVC 6 lives on top of new routing middleware model in ASP.NET 5. How do you setup? There is a configure method in Startup.cs file there you can say as shown in the following picture

image

inside the UseMvc extension method it is adding middleware and sets the MVC as default handler for routing. You can always override and write your own routing paths as shown in the following

image

Http routing is already there and you do not have to mention explicitly for Web API. Now you also need to add MVC services. By convention it is called ConfigureServices method, middleware  and services are different. Middleware sits in HttpRequest pipeline.

image

You can set the configuration sources in startup file as shown in the following

image

The dependency injection was used throughout MVC 6 and ASP.NET 5. Now both MVC and Web API sitting on same request pipeline. The modal binding in MVC 6 looks as shown in the following

image

you can get the modal binding from http header up to post. You can also use FromServices attributes. The same modal binding can be used in web api.

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.

Add Comment

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud