Questions tagged [autofac-module]
82 questions
1
vote
1 answer
ConfigurationModule passed into Module and context - DotNet Core
So I'm trying to use Autofac DI to pass my configuration json file through the stack. My Main function is as follows:
static void Main(string[] args)
{
Console.WriteLine("Starting...");
// Add the configuration to the…

Chris
- 805
- 6
- 19
1
vote
1 answer
Autofac: How to separate multiple plugins
I got a project generating output for different formats.
The architecture is about like this:
Xyz.Core
Xyz.FormatA
Xyz.FormatB
Xyz.Runner`
both Xyz.FormatA and ...FormatB depend on ...Core.
Runner depends on everything.
Now Core exposes all kinds…

ModernRonin
- 73
- 1
- 7
1
vote
1 answer
Registering Autofac modules acting as if async
I've encountered a strange issue with using Autofac. I have a module whose Load method looks like this:
builder.RegisterType().As();
// ...
AddSomethingToAList(bar);
// ...
Where AddSomethingToAList does exactly what it says on the tin,…

Kat
- 4,645
- 4
- 29
- 81
1
vote
1 answer
IAutofacActionFilter injecting a logger
I'm using NLog with this module:
public class LoggingModule : Autofac.Module
{
protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
{
registration.Preparing…
user47589
1
vote
1 answer
How to use Autofac Modules with Muti-Tenant container?
How is it possible to use Autofac's Modules combined with the Multitenant package?
This is my bootstrapping part for Autofac:
var builder = new ContainerBuilder();
// only very basic common registrations here...
// everything else is in…

Beachwalker
- 7,685
- 6
- 52
- 94
0
votes
0 answers
Autofac: AddAuthentication inside a module in ASP.NET Core
I would like to know how to register the authentication service (e.g. AddAuthentication().AddJwtBearer()) inside a module which dwells on its own assembly.
I tried using the builder.Populate(services) but I am confused of whether is OK since AutoFac…

Vico
- 1
0
votes
1 answer
How to register HealthCheck in Autofac module
Im using .NET 6 and Autofac to register my dependencies, all works great.
However I was wondering how can I register a healthcheck in my module (not in the startup.cs), ex:
public class InfrastructureModule : Module
{
protected override…

Arh Hokagi
- 170
- 5
- 21
0
votes
1 answer
Autofac RegisterAssemblyOpenGenericTypes matching query
I'm attempting to register all open generic components I tag with a custom attribute. The query finds the class correctly but the interface is not registered properly. I'm able to register and resolve the component fine using…

Eric Williams
- 35
- 7
0
votes
1 answer
Autofac failing to Resolve Module when module instantiated with Activator
I am attempting to use a custom attribute to define modules in external libraries I want my framework container to load. I’m able to scan the assembly, find and validate my types, and return a list of instantiated IModules. However when I attempt to…

Eric Williams
- 35
- 7
0
votes
0 answers
Unable to inject object by method with Autofac in multiple assembly project in .NET Framework 4.8
I have a problem with method injection between assemblies in a multiple assembly project. It only works for me in the scope of the Assembly1 with Autofac configuration.
I set the Autofac with the below packages: Autofac 3.5.2, Autofac.MVC4 3.1.0,…

Lampart123
- 3
- 3
0
votes
1 answer
Implementing IConfiguration with Autofac
im trying to use Autofac and configure an appconfig.json:
private static void RegisterAppSettingsConfiguration(ContainerBuilder builder)
{
var config = new ConfigurationBuilder()
…

Erythana
- 41
- 4
0
votes
0 answers
Autofac AutoFac.Mvc5 unable to find RegisterControllers method
Unable to find RegisterControllers in Autofac.Mvc5. Any idea how to resolve this issue ?
using Autofac;
using Autofac.Integration.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace OdeToFood.Web
{
…

Salman Ahmad
- 39
- 2
- 10
0
votes
0 answers
Autofac Module in ASP.NET Core AttachToComponentRegistration not called
I'm migrating from ASP.Net to Asp.Net Core using Autofac.Extensions.DependencyInjection nuget package.
For our logging service we used a Module to set the context of the logger to the type it is injected to:
internal class ContextualLoggingModule :…

Eike S
- 300
- 1
- 11
0
votes
1 answer
Does Autofac provides means to load unload plugin with services/middleware on runtime?
I am new to autofac and using .net 5-6 in my projects, i built my app in different modules which are loaded in app startup (using alc). But i was wondering if its possible with autofac to load/unload these full app plugins on runtime. much like how…

Alok
- 808
- 13
- 40
0
votes
1 answer
using Module-specific registration at resolve time?
I have an application that uses two different modules (implemented as Autofac.Module) that register the services they provide. Each simply has an adapter for hardware devices that produce the same data via different methods.
public class AdapterA :…

Krazykraut
- 11
- 2