Пример #1
0
        /*============================================================================*/
        /* Constructor                                                                */
        /*============================================================================*/

        /// <summary>
        /// Creates a Command Executor
        /// </summary>
        /// <param name="injector">The Injector to use. A child injector will be created from it.</param>
        /// <param name="removeMapping">removeMapping Remove mapping handler (optional)</param>
        /// <param name="handleResult">handleResult Result handler (optional)</param>
        /// <param name="onPreprocessCommandExecuting">onPreprocessCommandExecuting Preprocess before executing command (optional)</param>
        public CommandExecutor(IInjector injector, RemoveMappingDelegate removeMapping = null, HandleResultDelegate handleResult = null, OnPreprocessCommandExecutingDelegate onPreprocessCommandExecuting = null)
        {
            _injector      = injector.CreateChild();
            _removeMapping = removeMapping;
            _handleResult  = handleResult;
            _onPreprocessCommandExecuting = onPreprocessCommandExecuting;
        }
		/*============================================================================*/
		/* Public Functions                                                           */
		/*============================================================================*/

		public void Extend(IContext context)
		{
			context.BeforeInitializing(BeforeInitializing);
			context.BeforeDestroying(BeforeDestroying);
			context.WhenDestroying(WhenDestroying);
			_injector = context.injector;
			_injector.Map(typeof(IViewProcessorFactory)).ToValue(new ViewProcessorFactory(_injector.CreateChild()));
			_injector.Map(typeof(IViewProcessorMap)).ToSingleton(typeof(ViewProcessorMap));
		}
Пример #3
0
        /*============================================================================*/
        /* Public Functions                                                           */
        /*============================================================================*/

        public void Extend(IContext context)
        {
            context.BeforeInitializing(BeforeInitializing);
            context.BeforeDestroying(BeforeDestroying);
            context.WhenDestroying(WhenDestroying);
            _injector = context.injector;
            _injector.Map(typeof(IViewProcessorFactory)).ToValue(new ViewProcessorFactory(_injector.CreateChild()));
            _injector.Map(typeof(IViewProcessorMap)).ToSingleton(typeof(ViewProcessorMap));
        }
Пример #4
0
 /// <summary>
 ///     Creates a child ioc adapter.
 /// </summary>
 /// <returns>
 ///     An instance of <see cref="IIocContainer" />.
 /// </returns>
 public IIocContainer CreateChild()
 {
     this.NotBeDisposed();
     return(new MugenContainer(_injector.CreateChild(), this));
 }
		/*============================================================================*/
		/* Constructor                                                                */
		/*============================================================================*/

		/// <summary>
		/// Creates a Command Executor
		/// </summary>
		/// <param name="injector">The Injector to use. A child injector will be created from it.</param>
		/// <param name="removeMapping">removeMapping Remove mapping handler (optional)</param>
		/// <param name="handleResult">handleResult Result handler (optional)</param>
		public CommandExecutor (IInjector injector, RemoveMappingDelegate removeMapping = null, HandleResultDelegate handleResult = null)
		{
			_injector = injector.CreateChild();
			_removeMapping = removeMapping;
			_handleResult = handleResult;
		}
Пример #6
0
        public static IInjector CreateChild(this IInjector source)
        {
            var o = source.CreateChild(null);

            return(o);
        }