Ejemplo n.º 1
0
        public virtual void Register(string name, IComponentFactory componentFactory)
        {
            if (componentFactory == null)
            {
                throw new ArgumentNullException();
            }

            var contracts = componentFactory.GetContractTypes();

            // TODO: Better description of the component causing the exception
            if (!contracts.Any())
            {
                throw new CompositionException("No contracts found for the component factory " + componentFactory);
            }

            foreach (var contract in contracts)
            {
                InternalRegister(contract, name, componentFactory, false);
            }
        }