Example #1
0
        /*/// <summary>
         * ///   Constructs a container using the specified
         * ///   <see cref = "IConfigurationInterpreter" /> implementation.
         * /// </summary>
         * /// <param name = "interpreter">The instance of an <see cref = "IConfigurationInterpreter" /> implementation.</param>
         * public EssexContainer(IConfigurationInterpreter interpreter)
         *  : this()
         * {
         *  if (interpreter == null)
         *  {
         *      throw new ArgumentNullException("interpreter");
         *  }
         *  interpreter.ProcessResource(interpreter.Source, kernel.ConfigurationStore, kernel);
         *
         *  RunInstaller();
         * }
         *
         *      /// <summary>
         * ///   Constructs a container using the specified
         * ///   <see cref = "IConfigurationStore" /> implementation.
         * /// </summary>
         * /// <param name = "store">The instance of an <see cref = "IConfigurationStore" /> implementation.</param>
         * public EssexContainer(IConfigurationStore store)
         *  : this()
         * {
         *  kernel.ConfigurationStore = store;
         *
         *  RunInstaller();
         * }
         *
         *
         *
         * /// <summary>
         * ///   Initializes a new instance of the <see cref = "EssexContainer" /> class.
         * /// </summary>
         * /// <param name = "interpreter">The interpreter.</param>
         * /// <param name = "environmentInfo">The environment info.</param>
         * public EssexContainer(IConfigurationInterpreter interpreter, IEnvironmentInfo environmentInfo)
         *  : this()
         * {
         *  if (interpreter == null)
         *  {
         *      throw new ArgumentNullException("interpreter");
         *  }
         *  if (environmentInfo == null)
         *  {
         *      throw new ArgumentNullException("environmentInfo");
         *  }
         *
         *  interpreter.EnvironmentName = environmentInfo.GetEnvironmentName();
         *  interpreter.ProcessResource(interpreter.Source, kernel.ConfigurationStore, kernel);
         *
         *  RunInstaller();
         * }*/


        public IEssexContainer Install(params IEssexInstaller[] installers)
        {
            if (installers == null)
            {
                throw new ArgumentNullException("installers");
            }
            if (installers.Length != 0)
            {
                DefaultComponentInstaller scope  = new DefaultComponentInstaller();
                IKernelInternal           kernel = this.kernel as IKernelInternal;
                if (kernel == null)
                {
                    this.Install(installers, scope);
                }
                else
                {
                    IDisposable disposable = kernel.OptimizeDependencyResolution();
                    this.Install(installers, scope);
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            return(this);
        }