/// <summary>
        /// Registers a specific type as being the implementation type for a given interface type
        /// (which need not necessarily be an interface).  After this is called, Load() should be
        /// called to actually wire up the container.
        /// </summary>
        /// <typeparam name="TInterface">The type to be requested from the container.</typeparam>
        /// <typeparam name="TImplementation">The type to be supplied by the container in response.</typeparam>
        public IMapping <TInterface, TImplementation> Map <TInterface, TImplementation>() where TImplementation : TInterface
        {
            var registry = new Registry();
            var mapping  = new StructureMapMapping <TInterface, TImplementation>(registry);

            Register(registry);
            return(mapping);
        }
        /// <summary>
        /// Registers a function to return an instance of a given interface type (which need not
        /// necessarily be an interface).  After this is called, Load() should be called to
        /// actually wire up the container.
        /// </summary>
        /// <typeparam name="TInterface">The type to be requested from the container.</typeparam>
        /// <param name="function">A function that returns an instance of the specified type.</param>
        public IMapping <TInterface, TInterface> Map <TInterface>(Func <IServiceLocator, TInterface> function)
        {
            var registry = new Registry();
            var mapping  = new StructureMapMapping <TInterface, TInterface>(registry, function);

            Register(registry);
            return(mapping);
        }
        /// <summary>
        /// Registers a specific type as being the implementation type for a given interface type
        /// (which need not necessarily be an interface).  After this is called, Load() should be
        /// called to actually wire up the container.
        /// </summary>
        /// <typeparam name="TInterface">The type to be requested from the container.</typeparam>
        /// <typeparam name="TImplementation">The type to be supplied by the container in response.</typeparam>
        public IMapping <TInterface, TImplementation> MapExplicitly <TInterface, TImplementation>() where TImplementation : TInterface
        {
            var registry = new Registry();
            var mapping  = new StructureMapMapping <TInterface, TImplementation>(registry);

            Register(registry);
            try
            {
                if (ExplicitRegistrations.Contains(typeof(TInterface)))
                {
                    throw new Exception();
                }
                ExplicitRegistrations.Add(typeof(TInterface));
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "The type {0} was already explicitly mapped", typeof(TInterface).FullName);
            }
            return(mapping);
        }