示例#1
0
        public IAppContainer WithConfig(IContainerConfig config)
        {
            Check.NotNull(config, nameof(config), "configuration not specified");

            if (this.Registry.AllManifests != null)
            {
                throw new ContainerException("Container has already been built.");
            }

            var configType = config.GetType();

            if (_configs.ContainsKey(configType))
            {
                throw new ContainerException(
                          $"Existing configuration of type: {config.GetType()} is already configured.");
            }

            _configs[configType] = config;
            return(this);
        }