Exemple #1
0
        public void Activate()
        {
            var appBuilder = new AppBuilder();

            appBuilder.Properties["host.AppName"] = _shellSettings.Name;

            var orderedMiddlewares = _owinMiddlewareProviders
                                     .SelectMany(p => p.GetOwinMiddlewares())
                                     .OrderBy(obj => obj.Priority, new FlatPositionComparer());

            foreach (var middleware in orderedMiddlewares)
            {
                middleware.Configure(appBuilder);
            }

            // Register the Orchard middleware after all others.
            appBuilder.UseOrchard();

            var pipeline  = appBuilder.Build();
            var allRoutes = new List <RouteDescriptor>();

            allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes()));
            allRoutes.AddRange(_httpRouteProviders.SelectMany(provider => provider.GetRoutes()));

            _routePublisher.Publish(allRoutes, pipeline);
            _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));

            using (var scope = _workContextAccessor.CreateWorkContextScope()) {
                using (var events = scope.Resolve <Owned <IOrchardShellEvents> >()) {
                    events.Value.Activated();
                }
            }

            _sweepGenerator.Activate();
        }
        public void Activate()
        {
            IAppBuilder appBuilder = new AppBuilder();

            appBuilder.Properties["host.AppName"] = _shellSettings.Name;

            var orderedMiddlewares = _owinMiddlewareProviders
                                     .SelectMany(p => p.GetOwinMiddlewares())
                                     .OrderBy(obj => obj.Priority, new FlatPositionComparer());

            foreach (var middleware in orderedMiddlewares)
            {
                middleware.Configure(appBuilder);
            }

            // register the Orchard middleware after all others
            appBuilder.UseOrchard();

            Func <IDictionary <string, object>, Task> pipeline = appBuilder.Build();

            var allRoutes = new List <RouteDescriptor>();

            allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes()));
            allRoutes.AddRange(_httpRouteProviders.SelectMany(provider => provider.GetRoutes()));

            _routePublisher.Publish(allRoutes, pipeline);
            _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));

            using (var events = _eventsFactory()) {
                events.Value.Activated();
            }

            _sweepGenerator.Activate();
        }
        public void Activate()
        {
            _routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes()));
            _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));

            _sweepGenerator.Activate();

            using (var events = _eventsFactory()) {
                events.Value.Activated();
            }
        }
        public void Activate()
        {
            var allRoutes = new List <RouteDescriptor>();

            allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes()));
            allRoutes.AddRange(_httpRouteProviders.SelectMany(provider => provider.GetRoutes()));

            _routePublisher.Publish(allRoutes);
            _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));

            using (var events = _eventsFactory()) {
                events.Value.Activated();
            }

            _sweepGenerator.Activate();
        }