/// <summary>
        /// Adds a new export definition.
        /// </summary>
        /// <param name="type">Type that is being exported.</param>
        /// <param name="registrationName">Registration name under which <paramref name="type"/>
        /// is being exported.</param>
        public void AddExportDefinition(Type type, string registrationName)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            var definitions = ReadOnlyDefinitions.Where(t => t.ServiceType == type &&
                                                        t.RegistrationName == registrationName);

            // We cannot add an export definition with the same type and registration name
            // since we will introduce cardinality problems
            if (definitions.Count() == 0)
            {
                m_Definitions.Add(new ExternalExportDefinition(type, registrationName));
            }
        }
        /// <summary>
        /// Registers a new type.
        /// </summary>
        /// <param name="type">Type that is being registered.</param>
        /// <param name="registrationName">Registration name under which <paramref name="type"/>
        /// is being registered.</param>
        /// <param name="factory">Optional factory method. If not supplied, the general
        /// factory method will be used.</param>
        /// <returns><see cref="FactoryExportProvider"/> instance for fluent registration.</returns>
        public FactoryExportProvider Register(Type type, string registrationName, Func <ExportProvider, object> factory = null)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (factory == null)
            {
                factory = ep => factoryMethod(type, registrationName);
            }

            var exportDefinitions = ReadOnlyDefinitions.Where(t => t.ContractType == type &&
                                                              t.RegistrationName == registrationName);

            // We cannot add an export definition with the same type and registration name
            // since we will introduce cardinality problems
            if (exportDefinitions.Count() == 0)
            {
                definitions.Add(new FactoryExportDefinition(type, registrationName, factory));
            }

            return(this);
        }