Beispiel #1
0
        /// <summary>
        /// Creates an <see cref="IServiceProvider"/> containing services from the provided <see cref="IServiceCollection"/>
        /// optionaly enabling scope validation.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> containing service descriptors.</param>
        /// <param name="options">
        /// Configures various service provider behaviors.
        /// </param>
        /// <returns>The <see cref="IServiceProvider"/>.</returns>
        public static ServiceProvider BuildServiceProvider(this AliceServiceCollection services, ServiceProviderOptions options)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(new ServiceProvider(services, options));
        }
Beispiel #2
0
 /// <summary>
 /// Creates an <see cref="IServiceProvider"/> containing services from the provided <see cref="IServiceCollection"/>
 /// optionaly enabling scope validation.
 /// </summary>
 /// <param name="services">The <see cref="IServiceCollection"/> containing service descriptors.</param>
 /// <param name="validateScopes">
 /// <c>true</c> to perform check verifying that scoped services never gets resolved from root provider; otherwise <c>false</c>.
 /// </param>
 /// <returns>The <see cref="IServiceProvider"/>.</returns>
 public static ServiceProvider BuildServiceProvider(this AliceServiceCollection services, bool validateScopes)
 {
     return(services.BuildServiceProvider(new ServiceProviderOptions {
         ValidateScopes = validateScopes
     }));
 }
 /// <inheritdoc />
 public IServiceProvider CreateServiceProvider(AliceServiceCollection containerBuilder)
 {
     return(containerBuilder.BuildServiceProvider(_options));
 }
Beispiel #4
0
        /// <summary>
        /// Creates an <see cref="IServiceProvider"/> containing services from the provided <see cref="IServiceCollection"/>.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> containing service descriptors.</param>
        /// <returns>The <see cref="IServiceProvider"/>.</returns>

        public static ServiceProvider BuildServiceProvider(this AliceServiceCollection services)
        {
            return(BuildServiceProvider(services, ServiceProviderOptions.Default));
        }
 /// <inheritdoc />
 public AliceServiceCollection CreateBuilder(AliceServiceCollection services)
 {
     return(services);
 }