示例#1
0
        public static IServiceProvider CreateServiceProvider(IocContainerType iocType, IServiceProvider serviceProvider)
        {
            switch (iocType)
            {
            case IocContainerType.ServiceCollection:
                return(new ServiceCollectionProvider(serviceProvider));

            case IocContainerType.ServiceCollectionPerRequest:
                return(new ServiceCollectionPerRequestProvider(serviceProvider));

            default:
                throw new ArgumentOutOfRangeException(nameof(iocType));
            }
        }
        public static IServiceProvider CreateServiceProvider(IocContainerType iocType, IContainer container)
        {
            switch (iocType)
            {
            case IocContainerType.Autofac:
                return(new AutofacServiceProvider(container));

            case IocContainerType.AutofacPerRequest:
                return(new AutofacPerRequestServiceProvider(container));

            default:
                throw new ArgumentOutOfRangeException(nameof(iocType));
            }
        }