コード例 #1
0
        /// <summary>
        /// Uses the <typeparamref name="TStartup"/> type configure a service provider instance.
        /// Uses the <typeparamref name="TConfigurationStartup"/> type to configure a service provider that provides services during the configuration configuration process.
        /// The <paramref name="configurationStartupConfigurationServicesProvider"/> provides services during the configuration configuration process of the service provider that provides services during the configuration configuration process.
        /// </summary>
        public static IServiceProvider UseStartup <TStartup, TConfigurationStartup>(this ServiceProviderBuilder serviceProviderBuilder, IServiceProvider configurationStartupConfigurationServicesProvider)
            where TStartup : class, IStartup
            where TConfigurationStartup : class, IConfigurationStartup
        {
            var configurationServiceProvider = serviceProviderBuilder.UseStartup <TConfigurationStartup>(configurationStartupConfigurationServicesProvider);

            var serviceProvider = serviceProviderBuilder.UseStartup <TStartup>(configurationServiceProvider);

            return(serviceProvider);
        }
コード例 #2
0
        /// <summary>
        /// Uses the <typeparamref name="TStartup"/> type configure a service provider instance.
        /// An empty service provider is provided during the configuration configuration process.
        /// </summary>
        public static IServiceProvider UseStartup <TStartup>(this ServiceProviderBuilder serviceProviderBuilder)
            where TStartup : class, IStartup
        {
            var serviceProvider = serviceProviderBuilder.UseStartup <TStartup>(ServiceProviderHelper.GetNewEmptyServiceProvider);

            return(serviceProvider);
        }
コード例 #3
0
        /// <summary>
        /// Uses the <typeparamref name="TStartup"/> type configure a service provider instance.
        /// The <paramref name="configurationServicesProviderProvider"/> provides a service provider that provides services during the configuration configuration process.
        /// </summary>
        public static IServiceProvider UseStartup <TStartup>(this ServiceProviderBuilder serviceProviderBuilder, Func <IServiceProvider> configurationServicesProviderProvider)
            where TStartup : class, IStartup
        {
            var configurationServicesProvider = configurationServicesProviderProvider();

            var serviceProvider = serviceProviderBuilder.UseStartup <TStartup>(configurationServicesProvider);

            return(serviceProvider);
        }