Extend Autofac IoC container configuration at runtime in ASP.NET Core
NickName:rafalxyz Ask DateTime:2021-01-22T19:08:01

Extend Autofac IoC container configuration at runtime in ASP.NET Core

I have an ASP.NET Core 5 MVC application and I use Autofac as my IoC container. To integrate Autofac with ASP.NET Core I use Autofac.Extensions.DependencyInjection package. I'm looking for a way to register services from dynamically loaded assembly. I know that I can do that on application startup, but I need to do that at some later point in time. E.g. user goes to admin page and enables some module. During HTTP request processing I'd like to load assembly corresponding to that module and register services from that assembly. Do you have any idea how to do that?

Copyright Notice:Content Author:「rafalxyz」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65843987/extend-autofac-ioc-container-configuration-at-runtime-in-asp-net-core

More about “Extend Autofac IoC container configuration at runtime in ASP.NET Core” related questions

Extend Autofac IoC container configuration at runtime in ASP.NET Core

I have an ASP.NET Core 5 MVC application and I use Autofac as my IoC container. To integrate Autofac with ASP.NET Core I use Autofac.Extensions.DependencyInjection package. I'm looking for a way to

Show Detail

Using Autofac in an embedded ASP.NET Core project

I am using ASP.NET Core 2.1 in a WPF application for providing a REST API access to the application. The application uses Autofac and several modules are already registered at the start of the

Show Detail

ASP.NET Core 3.x - Access IoC Container

In ASP.NET Core 3.x, the usage of IoC containers like Autofac changed. Instead of returning some adapter instance in ConfigureServices, we have to use the new ConfigureContainer method. My questio...

Show Detail

Java IoC Container Most Similar to Autofac

I'm a .NET developer primarily but am looking to use IoC in a Java project. I have strong familiarity with Autofac. Is there an IoC container for Java that is substantially similar to Autofac in t...

Show Detail

ASP.NET Core with existing IoC container & environment?

I'd like to run the ASP.NET Core web stack along with MVC within a Windows service environment which already hosts an existing application in order to provide a frontend for it. The application uses

Show Detail

IoC Container Configuration/Registration

I absolutely need to use an IoC container for decoupling dependencies in an ever increasingly complex system of enterprise services. The issue I am facing is one related to configuration (a.k.a.

Show Detail

Using MvvmCross 5.6 NavigationService with autofac IoC

I am undergoing an mvvmcross upgrade from 4.* to 5.6. This is in a Xamarin.Android project. Autofac is registered as the IoT container and has been since day 1. During the upgrade I have had to i...

Show Detail

Using autofac in asp.net core 2.2

I am trying to use latest Autofac with asp.net core 2.2 project. However documentation of autofac seems to be outdated. I am trying to use autofac without ConfigureContainer: // ConfigureServices is

Show Detail

Registering an existing Autofac container with ASP.NET Core

I'm currently building a server application that speaks a custom protocol over TCP. This server application currently uses Autofac for dependency injection. Recently though, I've added an ASP.NET ...

Show Detail

Autofac. IoC container with parameters. Best practices

After studing the Autofac documentation, and some stackoverflow questions Best Practices for IOC Container, IoC Container. Inject container I understand that I need put container on highes level,...

Show Detail