Exemple #1
0
    public static void Register()
    {
        var container = CompositionRoot.Compose();

#if DependencyResolver
// ************************************************************************************** //
//  Dependency Resolver
//
//  You may use this option if you are using MVC 3 or higher and you have other code
//  that references DependencyResolver.Current.GetService() or DependencyResolver.Current.GetServices()
//
// ************************************************************************************** //

// Reconfigure MVC to use Service Location
        var dependencyResolver = new InjectableDependencyResolver(container, DependencyResolver.Current);
        DependencyResolver.SetResolver(dependencyResolver);
#else
        // ************************************************************************************** //
        //  Controller Factory
        //
        //  It is recommended to use Controller Factory unless you are getting errors due to a conflict.
        //
        // ************************************************************************************** //

        // Reconfigure MVC to use DI
        var controllerFactory = new InjectableControllerFactory(container);
        ControllerBuilder.Current.SetControllerFactory(controllerFactory);
#endif

        MvcSiteMapProviderConfig.Register(container);
    }
Exemple #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            if (AppConfigConfiguration.Instance.Setup.IsCompleted)
            {
                //WebApiConfig.Register(GlobalConfiguration.Configuration);
                GlobalConfiguration.Configure(WebApiConfig.Register);

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

                MvcSiteMapProviderConfig.Register(DependencyResolver.Current);

                AuthConfig.RegisterAuth();

                ModelBinders.Binders[typeof(SearchParameters)]  = new SearchParametersBinder();
                ModelBinders.Binders[typeof(CategoryPathModel)] = new CategoryPathModelBinder();


                ModelValidatorProviders.Providers.RemoveAt(0);
                ModelValidatorProviders.Providers.Insert(0, new VirtoDataAnnotationsModelValidatorProvider());
            }
        }
    public static void Register()
    {
#if NET35
        MvcSiteMapProvider.DI.Composer.Compose();
#endif
#if Demo
        if (new MvcSiteMapProvider.DI.ConfigurationSettings().UseExternalDIContainer)
        {
#endif
        var container = CompositionRoot.Compose();
#if !MVC2
#if DependencyResolver //preserve
        // ************************************************************************************** //
        //  Dependency Resolver
        //
        //  You may use this option if you are using MVC 3 or higher and you have other code
        //  that references DependencyResolver.Current.GetService() or DependencyResolver.Current.GetServices()
        //
        // ************************************************************************************** //

        // Reconfigure MVC to use Service Location
        var dependencyResolver = new InjectableDependencyResolver(container, DependencyResolver.Current);
        DependencyResolver.SetResolver(dependencyResolver);
#else //preserve
      // ************************************************************************************** //
      //  Controller Factory
      //
      //  It is recommended to use Controller Factory unless you are getting errors due to a conflict.
      //
      // ************************************************************************************** //

        // Reconfigure MVC to use DI
        var controllerFactory = new InjectableControllerFactory(container);
        ControllerBuilder.Current.SetControllerFactory(controllerFactory);
#endif //preserve
#else
        // Reconfigure MVC to use DI
        var controllerFactory = new InjectableControllerFactory(container);
        ControllerBuilder.Current.SetControllerFactory(controllerFactory);
#endif
        MvcSiteMapProviderConfig.Register(container);
#if Demo
    }

    else
    {
        // Register the Sitemaps routes for search engines
        MvcSiteMapProvider.Web.Mvc.XmlSiteMapController.RegisterRoutes(System.Web.Routing.RouteTable.Routes);
    }
#endif
    }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);

            MvcSiteMapProviderConfig.Register(CompositionRoot.Compose());
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Performance - faster razor rendering?
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
        }
Exemple #5
0
        public void Configuration(IAppBuilder app)
        {
            var container         = CompositionRoot.Compose();
            var controllerFactory = new InjectableControllerFactory(container);

            ControllerBuilder.Current.SetControllerFactory(controllerFactory);
            MvcSiteMapProviderConfig.Register(container);
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext <ApplicationSignInManager>(ApplicationSignInManager.Create);
            app.CreatePerOwinContext <ApplicationRoleManager>(ApplicationRoleManager.Create);
            //GlobalHost.HubPipeline.RequireAuthentication(); <---------
            app.MapSignalR(new HubConfiguration
            {
                EnableJSONP             = true,
                EnableJavaScriptProxies = true,
                EnableDetailedErrors    = true
            });
        }