What has changed from MVC4 to MVC5?

10

I have read some topics on the subject, some say it has changed very little, others say that it was very important changes. I would like to know your opinion on the subject, I currently do projects with WebForms so I do not have any knowledge about MVC, and I bought an MVC4 book, that migration worries me a little.

    
asked by anonymous 02.12.2015 / 14:13

2 answers

5

There is an official page saying what was the news, do not need to use opinions, which are not accepted here. Essentially everything you learn in 4 can be availed in 5. There are also important changes in subsequent versions, 5.1 , 5.2 .

If you just want to know if the book is lost or not, of course not. But learning from younger material is always better. The important thing is to learn everything correctly.

Actually if it's going to start, I'd think about the ASP.NET Core . This has had more important changes. He is the future, worth investing in. Earlier versions are considered legacy.

    
02.12.2015 / 14:23
9

In short, a lot.

Detailing a little more, the most important changes are:

  • Scaffolds updated to support Bootstrap, which is installed by default for new projects;
  • Scaffolding feature becomes native to Visual Studio, with support for asynchronous transactions, new Entity Framework 6, or default ASP.NET MVC feature. Formerly Scaffolding was done only by MvcScaffolding , but Mr. Sanderson thought it was okay to abandon the project and left a lot of people in the hand. Recently, a cool named David Douglas Anderson resumed the project, for the happiness of all , so now the community has the two Scaffolding options, being the most powerful command line;
  • Deprecation of ASP.NET Membership and introduction of ASP.NET Identity, more comprehensive and supported two-factor authentication (confirmation by SMS or email, for example), integration with known OAuth providers (Facebook, Google+ , Twitter, etc.) and greater possibilities of customization of this authentication;
  • Great update of HtmlHelper and all its extensions ( LinkExtensions , SelectExtensions , InputExtensions , EditorExtensions , InputExtensions , etc.);
  • Introduction of OWIN , a new interface specification that will govern all versions of ASP.NET MVC from now on;
  • Decentralization of the global environment initialization, previously done only by Global.asax.cs , now done by partial classes named Startup ;
  • Write option for routes by attribute in each Action ;
  • Web API 2 becomes an embedded design standard in Visual Studio versions 2012 and 2013;

As of this date, ASP.NET MVC5 is still the stable version (ASP.NET 5 and MVC6 are still release candidates ), but, #

Some changes are quite deep, and I can already speak of some of them:

  • The .NET compiler becomes platform independent (running on both Mac and Linux);
  • Visual Studio is no longer the only official IDE (there is also the Visual Studio Code , platform independent);
  • In MVC5, it is not possible to take advantage of (at least not without some great refactoring) the logic of a Controller between an MVC application and an API Web application 2 because the implementations of each < > Controller are very different between them. This should end in ASP.NET 5 and MVC6;
  • IoC and DI become design standards. Up to MVC5, it is possible to use IoC and DI, but through third-party packages and some configuration;
  • NuGet is no longer the only supported platform for packages. Bower, Grunt and npm support are guaranteed;
  • Scaffolding happens to be done using Yeoman, not the Visual Studio IDE anymore.
  

Maybe I'll have to edit this answer a couple of times, maybe because the MVC6 will stabilize soon. I ask everyone to remind me when something goes wrong or I have forgotten some important detail so that I can improve this answer even more.

    
02.12.2015 / 15:07