/// <summary> /// Use the given <paramref name="serviceProvider"/> instance to create named service instances during /// a mapping. The given object must expose one of the following public, instance methods: /// - GetService(Type type) /// - GetService(Type type, string name) /// - GetInstance(Type type) /// - GetInstance(Type type, string name) /// - Resolve(Type type) /// - Resolve(Type type, string name) /// Overloads with a 'name' parameter can also take one or more optional or params array parameters. If /// no useable methods are found, a <see cref="MappingConfigurationException"/> is thrown. /// </summary> /// <typeparam name="TServiceProvider">The Type of the service provider object to use.</typeparam> /// <param name="serviceProvider">The service provider instance to use.</param> /// <returns> /// An <see cref="IGlobalMappingSettings"/>, with which to globally configure other mapping aspects. /// </returns> public IGlobalMappingSettings UseServiceProvider <TServiceProvider>(TServiceProvider serviceProvider) where TServiceProvider : class { foreach (var provider in ConfiguredServiceProvider.CreateFromOrThrow(serviceProvider)) { UserConfigurations.Add(provider); } return(this); }