PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/MvcMusicStore/Global.asax.cs

#
C# | 42 lines | 32 code | 8 blank | 2 comment | 0 complexity | 42fec66ea3cc49fc9ca82552eb17d580 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Web;
 5using System.Web.Mvc;
 6using System.Web.Routing;
 7
 8namespace MvcMusicStore
 9{
10    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
11    // visit http://go.microsoft.com/?LinkId=9394801
12
13    public class MvcApplication : System.Web.HttpApplication
14    {
15        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
16        {
17            filters.Add(new HandleErrorAttribute());
18        }
19
20        public static void RegisterRoutes(RouteCollection routes)
21        {
22            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
23
24            routes.MapRoute(
25                "Default", // Route name
26                "{controller}/{action}/{id}", // URL with parameters
27                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
28            );
29
30        }
31
32        protected void Application_Start()
33        {
34            System.Data.Entity.Database.SetInitializer(new MvcMusicStore.Models.SampleData());
35
36            AreaRegistration.RegisterAllAreas();
37
38            RegisterGlobalFilters(GlobalFilters.Filters);
39            RegisterRoutes(RouteTable.Routes);
40        }
41    }
42}