The version of ASP. NET MVC is updated very quickly, and each version is built on the previous version to optimize performance and improve functionality.
Below, I compare the next two versions and find the most basic differences. (In the Update supplement: )
I. About the different configuration class global.asax
To reduce the clutter of the configuration class, ASP. NET MVC 4 will separate the contents of the Global.asax file into several configuration files under App_start.
in ASP. NET MVC 3:
Public Static voidregisterglobalfilters (globalfiltercollection filters) {filters. ADD (NewHandleerrorattribute ());}
//set up Routes Public Static voidregisterroutes (routecollection routes) {routes. Ignoreroute ("{Resource}.axd/{*pathinfo}"); Routes. MapRoute ("Default",//Route name "{Controller}/{action}/{id}",//route matching format, default URL New{controller ="Home", action ="Index", id = urlparameter.optional}//Default Parameters );}protected voidApplication_Start () {arearegistration.registerallareas (); //Use LocalDB for Entity Framework by defaultDatabase.defaultconnectionfactory =NewSqlconnectionfactory (@"Data source= (localdb) \v11.0; Integrated security=true; Multipleactiveresultsets=true"); Registerglobalfilters (globalfilters.filters); RegisterRoutes (routetable.routes); BootstrapSupport.BootstrapBundleConfig.RegisterBundles (System.Web.Optimization.BundleTable.Bundles); BootstrapMvcSample.ExampleLayoutsRouteConfig.RegisterRoutes (routetable.routes);}
in ASP. NET MVC 4:
protected void Application_Start () { arearegistration.registerallareas (); webapiconfig. Register (globalconfiguration.configuration); filterconfig. Registerglobalfilters (globalfilters.filters); routeconfig. RegisterRoutes (routetable.routes); bundleconfig. Registerbundles (bundletable.bundles);}
Where the config file is used separately in the App_start folder.
WebApiConfig.cs: filterconfig.cs : routeconfig.cs: Bundleconfig.cs: related to bundling and narrowing of register Bundles, default CSS and JS, and so on.