view Agendas/trunk/src/Agendas.Web/Global.asax.cs @ 284:79942e030118

#123: Patrocinadores de las vans: Se verifica que para publicar una Van, debe tener al menos un Patrocinador.
author juanjose.montesdeocaarbos
date Wed, 28 Dec 2011 09:35:27 -0300
parents bf993f99cee3
children
line wrap: on
line source

using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Factories;
using AltNetHispano.Agendas.Resources.Properties;
using AltNetHispano.Agendas.Web.CustomModelMetadataProvider;

namespace AltNetHispano.Agendas.Web
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
    	private static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
			filters.Add(NHibernateFactory.GetNHibernateSessionPerAction());
        }

    	private static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
        	ModelMetadataProviders.Current =
        		new DataAnnotationAndConventionModelMetadataProvider(
        			new ResolverThroughResource<DataAnnotationResources>());

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            IdentityContext.Init(new HttpContextIdentityProvider(), AgendaFactory.GetPersonaRepository());
        }
    }
}