示例#1
0
        /// <summary>
        ///  Wires everything up
        /// </summary>
        /// <returns></returns>
        public virtual IUmbracoApplicationContext Boot()
        {
            LogHelper.TraceIfEnabled <BootManager>("Booting");
            var container = _containerDelegate();

            container.AddDependencyDemandBuilder(_umbracoWireup);

            var built = container.Build();
            //var resolver = (IDependencyResolver)Activator.CreateInstance(_dependencyResolverType, new[] { built });
            var mvcResolver = _mvcResolverFactory.Invoke(built);

            DependencyResolver.SetResolver(mvcResolver);

            _taskManager = built.Resolve <ApplicationTaskManager>();

            //launch pre-app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PreAppStartupComplete, new TaskExecutionContext(this, null));

            // Initialise the Umbraco system (v2)
            // If this is a Cms app:
            LogHelper.TraceIfEnabled <BootManager>("Booting CmsBootstrapper");
            built.Resolve <CmsBootstrapper>().Boot(RouteTable.Routes);

            // If this is a front-end app:
            LogHelper.TraceIfEnabled <BootManager>("Booting RenderBootstrapper");
            built.Resolve <RenderBootstrapper>().Boot(RouteTable.Routes);

            //launch post app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PostAppStartup, new TaskExecutionContext(this, null));

            return(built.Resolve <IUmbracoApplicationContext>());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public FakeFrameworkContext()
 {
     var fakeMapperList = new List<Lazy<AbstractMappingEngine, TypeMapperMetadata>>();
     TypeMappers = new MappingEngineCollection(fakeMapperList);
     CurrentLanguage = Thread.CurrentThread.CurrentCulture;
     TextManager = LocalizationConfig.SetupDefault();
     ScopedFinalizer = new NestedLifetimeFinalizer();
     TaskManager = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
     ApplicationCache = new HttpRuntimeApplicationCache();
     ScopedCache = new ThreadStaticScopedCache();
 }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public FakeFrameworkContext()
        {
            var fakeMapperList = new List <Lazy <AbstractMappingEngine, TypeMapperMetadata> >();

            TypeMappers      = new MappingEngineCollection(fakeMapperList);
            CurrentLanguage  = Thread.CurrentThread.CurrentCulture;
            TextManager      = LocalizationConfig.SetupDefault();
            ScopedFinalizer  = new NestedLifetimeFinalizer();
            TaskManager      = new ApplicationTaskManager(Enumerable.Empty <Lazy <AbstractTask, TaskMetadata> >());
            ApplicationCache = new HttpRuntimeApplicationCache();
            ScopedCache      = new ThreadStaticScopedCache();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultFrameworkContext"/> class.
 /// </summary>
 /// <param name="textManager">The text manager.</param>
 /// <param name="typeMappers">The type mappers.</param>
 /// <param name="scopedCache">The scoped cache.</param>
 /// <param name="applicationCache">The application cache</param>
 /// <param name="finalizer"></param>
 /// <param name="taskMgr"></param>
 /// <remarks></remarks>
 public DefaultFrameworkContext(
     TextManager textManager,
     MappingEngineCollection typeMappers,
     AbstractScopedCache scopedCache,
     AbstractApplicationCache applicationCache,
     AbstractFinalizer finalizer,
     ApplicationTaskManager taskMgr)
     : this(scopedCache, applicationCache, finalizer)
 {
     TextManager = textManager;
     TypeMappers = typeMappers;
     TaskManager = taskMgr;
 }
示例#5
0
        /// <summary>
        ///  Wires everything up
        /// </summary>
        /// <returns></returns>
        public virtual IRebelApplicationContext Boot()
        {
            Mandate.That <NullReferenceException>(_mvcDefaultRouteRegistration != null);
            Mandate.That <NullReferenceException>(_mvcAreaRegistration != null);
            Mandate.That <NullReferenceException>(_mvcCustomRouteRegistration != null);
            Mandate.That <NullReferenceException>(_mvcGlobalFilterRegistration != null);

            LogHelper.TraceIfEnabled <BootManager>("Booting");
            var container = _containerDelegate();

            container.AddDependencyDemandBuilder(_rebelWireup);

            var built = container.Build();
            //var resolver = (IDependencyResolver)Activator.CreateInstance(_dependencyResolverType, new[] { built });
            var mvcResolver = _mvcResolverFactory.Invoke(built);

            DependencyResolver.SetResolver(mvcResolver);

            _taskManager = built.Resolve <ApplicationTaskManager>();

            //launch pre-app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PreAppStartupComplete, new TaskExecutionContext(this, null));

            // Initialise the Rebel system (v2)
            // If this is a Cms app:
            LogHelper.TraceIfEnabled <BootManager>("Booting CmsBootstrapper");
            built.Resolve <CmsBootstrapper>().Boot(RouteTable.Routes);

            //register all standard MVC components after the CmsBootstrapper (which registers our custom areas)
            LogHelper.TraceIfEnabled <BootManager>("Registering MVC areas");
            _mvcAreaRegistration();

            LogHelper.TraceIfEnabled <BootManager>("Registering custom MVC routes");
            _mvcCustomRouteRegistration();

            // If this is a front-end app:
            LogHelper.TraceIfEnabled <BootManager>("Booting RenderBootstrapper");
            built.Resolve <RenderBootstrapper>().Boot(RouteTable.Routes);

            LogHelper.TraceIfEnabled <BootManager>("Registering MVC global filters");
            _mvcGlobalFilterRegistration();

            LogHelper.TraceIfEnabled <BootManager>("Registering MVC default routes");
            _mvcDefaultRouteRegistration();

            //launch post app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PostAppStartup, new TaskExecutionContext(this, null));

            return(built.Resolve <IRebelApplicationContext>());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public FakeFrameworkContext(ISerializer serializer = null)
 {
     serializer = serializer ?? new ServiceStackSerialiser();
     var fakeMapperList = new List<Lazy<AbstractMappingEngine, TypeMapperMetadata>>();
     TypeMappers = new MappingEngineCollection(fakeMapperList);
     CurrentLanguage = Thread.CurrentThread.CurrentCulture;
     TextManager = LocalizationConfig.SetupDefault();
     ScopedFinalizer = new NestedLifetimeFinalizer();
     TaskManager = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
     ApplicationCache = new HttpRuntimeApplicationCache();
     ScopedCache = new DictionaryScopedCache();
     Caches = new DefaultFrameworkCaches(new DictionaryCacheProvider(), new RuntimeCacheProvider());
     Serialization = new SerializationService(serializer);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public FakeFrameworkContext(ISerializer serializer = null)
        {
            serializer = serializer ?? new ServiceStackSerialiser();
            var fakeMapperList = new List <Lazy <AbstractMappingEngine, TypeMapperMetadata> >();

            TypeMappers      = new MappingEngineCollection(fakeMapperList);
            CurrentLanguage  = Thread.CurrentThread.CurrentCulture;
            TextManager      = LocalizationConfig.SetupDefault();
            ScopedFinalizer  = new NestedLifetimeFinalizer();
            TaskManager      = new ApplicationTaskManager(Enumerable.Empty <Lazy <AbstractTask, TaskMetadata> >());
            ApplicationCache = new HttpRuntimeApplicationCache();
            ScopedCache      = new DictionaryScopedCache();
            Caches           = new DefaultFrameworkCaches(new DictionaryCacheProvider(), new RuntimeCacheProvider());
            Serialization    = new SerializationService(serializer);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultFrameworkContext"/> class.
 /// </summary>
 /// <param name="textManager">The text manager.</param>
 /// <param name="typeMappers">The type mappers.</param>
 /// <param name="scopedCache">The scoped cache.</param>
 /// <param name="applicationCache">The application cache</param>
 /// <param name="finalizer">The finalizer.</param>
 /// <param name="taskMgr">The task manager.</param>
 /// <param name="caches">The lifetime-managed cache providers.</param>
 public DefaultFrameworkContext(
     TextManager textManager, 
     MappingEngineCollection typeMappers, 
     AbstractScopedCache scopedCache,
     AbstractApplicationCache applicationCache,
     AbstractFinalizer finalizer,
     ApplicationTaskManager taskMgr,
     IFrameworkCaches caches,
     AbstractSerializationService serialization)
     : this(scopedCache, applicationCache, finalizer, caches, serialization)
 {
     TextManager = textManager;
     TypeMappers = typeMappers;
     TaskManager = taskMgr;
 }
示例#9
0
        /// <summary>
        ///  Wires everything up
        /// </summary>
        /// <returns></returns>
        public virtual IRebelApplicationContext Boot()
        {
            Mandate.That<NullReferenceException>(_mvcDefaultRouteRegistration != null);
            Mandate.That<NullReferenceException>(_mvcAreaRegistration != null);
            Mandate.That<NullReferenceException>(_mvcCustomRouteRegistration != null);
            Mandate.That<NullReferenceException>(_mvcGlobalFilterRegistration != null);

            LogHelper.TraceIfEnabled<BootManager>("Booting");
            var container = _containerDelegate();
            container.AddDependencyDemandBuilder(_rebelWireup);

            var built = container.Build();
            //var resolver = (IDependencyResolver)Activator.CreateInstance(_dependencyResolverType, new[] { built });
            var mvcResolver = _mvcResolverFactory.Invoke(built);
            DependencyResolver.SetResolver(mvcResolver);

            _taskManager = built.Resolve<ApplicationTaskManager>();

            //launch pre-app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PreAppStartupComplete, new TaskExecutionContext(this, null));

            // Initialise the Rebel system (v2)
            // If this is a Cms app:
            LogHelper.TraceIfEnabled<BootManager>("Booting CmsBootstrapper");
            built.Resolve<CmsBootstrapper>().Boot(RouteTable.Routes);

            //register all standard MVC components after the CmsBootstrapper (which registers our custom areas)
            LogHelper.TraceIfEnabled<BootManager>("Registering MVC areas");
            _mvcAreaRegistration();

            LogHelper.TraceIfEnabled<BootManager>("Registering custom MVC routes");
            _mvcCustomRouteRegistration();

            // If this is a front-end app:
            LogHelper.TraceIfEnabled<BootManager>("Booting RenderBootstrapper");
            built.Resolve<RenderBootstrapper>().Boot(RouteTable.Routes);

            LogHelper.TraceIfEnabled<BootManager>("Registering MVC global filters");
            _mvcGlobalFilterRegistration();

            LogHelper.TraceIfEnabled<BootManager>("Registering MVC default routes");
            _mvcDefaultRouteRegistration();

            //launch post app startup tasks
            _taskManager.ExecuteInContext(TaskTriggers.PostAppStartup, new TaskExecutionContext(this, null));

            return built.Resolve<IRebelApplicationContext>();
        }
        private IFrameworkContext GetFrameworkContext()
        {
            TextManager textManager = LocalizationConfig.SetupDefault();
            MappingEngineCollection typeMappers = GetTypeMappers();

            AbstractScopedCache scopedCache = new DictionaryScopedCache();
            AbstractApplicationCache applicationCache = new HttpRuntimeApplicationCache();
            AbstractFinalizer finalizer = new NestedLifetimeFinalizer();
            var taskMgr = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
            IFrameworkContext frameworkContext = new DefaultFrameworkContext(textManager, typeMappers, scopedCache,
                                                                             applicationCache, finalizer, taskMgr);

            return frameworkContext;
        }