Asp Net MVC 6 is coming…

…and how about we take a look at what changed?

If you have developed with AspNet MVC in the past, you will see big changes in MVC 6. Let’s discuss at a high level a few of these changes.

MVC is no longer at System.Web

That’s right fellows, and what this impacts us?

Well, when we convert our old projects to the new MVC we can expect to something break.

Where is my global.asax?

You will no longer find global.asax in your project, but you will find a startup.cs. If you have used katana or something related to the OWIN specification, you may find some familiarity here.

In OWIN when you want to use a piece of middleware you create a startup.cs that like magic runs the configuration extensions in your file.

Now most of our framework configurations will happen inside the configure method of the startup class.

Native dependency injection

As I said, the way our AspNet application starts have changed, and with that, AspNet now already come with dependency injection native.

Inside our startup class, we will also have a method called configurationServices. In this method, we can use an IOC container to resolve our dependencies.

Where is my web.config?

If you got asking yourself, “where the heck is my web.config?” Well, it’s not there anymore.

In the past, .net configuration was a complex kind of configuration. You had a machine.config, and then a web.config inside your application, and even web.config inside your folder structure of your application.

Today, the new AspNet comes with no configuration at all. “OK, I will add my web.config”. You can do that, but today the preferable way is to add a config.json, and you can also have your web.config, init files and even your environment variables! We will get deeper in a next post.

MVC or web API? How about both!

In this new AspNet version, MVC and web API are now the same! How?

If you create a MVC controller you will see it derives from controller and if you create a web API controller you will see it also derives from controller. Both are in the same namespace.

But what this helps us?

  • If you need a global filter, it will need in only one place.
  • If you need a custom model binder, it will need in only one place.
  • When a Microsoft releases a new feature, it will come for both.

And that’s one part of the new things that are coming.

This post was way high level, in the next let’s create an app from zero with the new AspNet MVC.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.