public IServiceProvider ConfigureServices(IServiceCollection services) { // DryIoc specific workaround var container = new DryIocDIProvider { Container = new Container() .With(rules => rules.With(FactoryMethod.ConstructorWithResolvableArguments) .WithoutThrowOnRegisteringDisposableTransient()) }; DIContainer.Current = container; // Registrations using Microsoft.Extensions.DependencyInjection services.RegisterAll(); // Registrations using Simplify.DI DIContainer.Current.RegisterAll(); // Unresolved types fix DIContainer.Current.Register <IHttpContextAccessor, HttpContextAccessor>(LifetimeType.Singleton); return(DIContainer.Current.IntegrateWithMicrosoftDependencyInjectionAndVerify(services)); // return DIContainer.Current.IntegrateWithMicrosoftDependencyInjection(services); }
/// <summary> /// Initializes a new instance of the <see cref="DryIocLifetimeScope"/> class. /// </summary> /// <param name="provider">The provider.</param> public DryIocLifetimeScope(DryIocDIProvider provider) { _currentScopeProvider = new DryIocDIProvider { Container = provider.Container.OpenScope() }; Container = _currentScopeProvider; }
public IServiceProvider ConfigureServices(IServiceCollection services) { // DryIoc specific workaround var container = new DryIocDIProvider { Container = new Container() .With(rules => rules.With(FactoryMethod.ConstructorWithResolvableArguments)) }; DIContainer.Current = container; // Registrations using `services` services.Register(); // Registrations using `DIContainer.Current` IocRegistrations.Register(); return(DIContainer.Current.IntegrateWithMicrosoftDependencyInjectionAndVerify(services)); }
/// <summary> /// Initializes a new instance of the <see cref="DryIocLifetimeScope"/> class. /// </summary> /// <param name="provider">The provider.</param> public DryIocLifetimeScope(DryIocDIProvider provider) { _currentScopeProvider = new DryIocDIProvider { Container = provider.Container.OpenScope() }; Container = _currentScopeProvider; }