- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10
Simplify.DI.Microsoft.AspNetCore
        Alexanderius edited this page Jul 15, 2025 
        ·
        6 revisions
      
    How to replace 'Simplify.DI.Provider.Microsoft.Extensions.DependencyInjection' internal container with container from AspNetCore application
This allows us to perform registrations via Simplify.DI while keeping the original container in the AspNetCore application.
Install Simplify.DI.Provider.Microsoft.Extensions.DependencyInjection NuGet package.
In your Startup.cs, add this method:
public IServiceProvider ConfigureServices(IServiceCollection services)
{
    var provider = new MicrosoftDependencyInjectionDIProvider { Services = services };
    DIContainer.Current = provider;
    // Your registrations here (both via services or DIContainer.Current.Register)
    return provider.ServiceProvider;
}Alternatively:
public void ConfigureServices(IServiceCollection services)
{
    DIContainer.Current = new MicrosoftDependencyInjectionDIProvider { Services = services };
    // Your registrations here (both via services or DIContainer.Current.Register)
}