Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Simplify.DI.Microsoft.AspNetCore

Alexanderius edited this page Jun 23, 2019 · 5 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 keeping original container in 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;
}