Ejemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            ModelMetadataProviders.Current = new ModelMetadataProvider();

            DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(RequiredAttribute), typeof(RequiredAttributeAdapter));
            DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(IntegerAttribute), typeof(IntegerAttributeAdapter));
            DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(StringLengthAttribute), typeof(StringLengthAttributeAdapter));
            DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(RangeAttribute), typeof(RangeAttributeAdapter));
            DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(EmailAttribute), typeof(EmailAttributeAdapter));
            //DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(CompareAttribute), typeof(CompareAttributeAdapter));

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

            var configuration = new Configuration.Configuration();

            configuration.ConfigureDatabase();

            var builder = configuration.GetContainerBuilder();

            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            SiteMapManager.SiteMaps.Register <XmlSiteMap>("Library.en-US", sitmap => sitmap.LoadFrom("~/Sitemaps/Library.en-US.sitemap"));
            SiteMapManager.SiteMaps.Register <XmlSiteMap>("Library.ru-RU", sitmap => sitmap.LoadFrom("~/Sitemaps/Library.ru-RU.sitemap"));
        }