vgquotes/Src/VideoGameQuotes.Web/Global.asax.cs

35 lines
1.2 KiB
C#

using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.Practices.Unity;
using Portoa.Web;
using Portoa.Web.Unity;
using VideoGameQuotes.Api;
using VideoGameQuotes.Api.Persistence;
using VideoGameQuotes.Web.Security;
namespace VideoGameQuotes.Web {
public class MvcApplication : ApplicationBase {
protected override void ConfigureUnity() {
Container
.AddNewExtension<ConfigureLog4Net>()
.Configure<ILog4NetConfigurator>()
.SetName("VideoGameQuotes.Web")
.UseXml();
Container
.AddNewExtension<LogAllMethodCalls>()
.RegisterType<ICurrentUserProvider, SessionBasedUserProvider>()
.RegisterType<IUserService, UserService>()
.RegisterType<IUserRepository, UserRepository>();
}
protected override void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("media/{*anything}");
routes.MapRoute("about", "about", new { controller = "Home", action = "About" });
routes.MapRoute("contact", "contact", new { controller = "Home", action = "Contact" });
routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
}
}