Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [autofac]

Autofac is an inversion of control (IoC) container for Microsoft .NET. It manages the dependencies between classes so that applications stay easy to change as they grow in size and complexity. This is achieved by treating regular .NET classes as components.

0 votes
0 answers
16 views

Depedency Injection with Autofac and Automapper

I have project where I implement Autofac and Automapper. There is no any problem when I added Automapper, but when I want to add mine implementation of interface I came across error with Automapper. ...
Wiesław Śruta's user avatar
1 vote
1 answer
26 views

Autofac reporting circular dependency only when using keyed attribute

I'm trying to inject a specific keyed object into another's constructor, but autofac 8.0.0 raises an exception that there is a circular dependency: Circular component dependency detected: ...
LogicMan's user avatar
0 votes
0 answers
33 views

The Web API responds to the browser before the await Task.Delay finished executing

I'm working on an OWIN ASP.NET Web API 2 application which uses Autofac. I ran into some issues because some code after await is never executed when the client app (browser) is cancelling the request. ...
user25652029's user avatar
-1 votes
1 answer
24 views

Autofac DI and "Child" Scopes

I have a project where I use Autofac to create UI components. I would like some of my Autofac-created UI components to have child components that can potentially reference their parent. What is the ...
Tony Valenti's user avatar
1 vote
1 answer
25 views

How to make Worker class compatible with AutoFac also with Microsoft Dependency Injections

I have an worker service what will be consumed in two project. First project use Autofac for dependency injection the other use Microsoft.Extensions.DependencyInjection First Worker look like: public ...
user24500090's user avatar
0 votes
2 answers
43 views

Second Mediator Call Fails with ObjectDisposedException in ASP.NET Core Using Autofac: "Instances cannot be resolved as it has already been disposed"

I am trying to run two mediator calls inside a method. For some reason, the second mediator call always fail. I am expecting both calls to run without error. The full error message is: System....
SushiCode's user avatar
0 votes
0 answers
22 views

Autofac: None of the constructors found on type 'DataContext' can be invoked with the available services and parameters:

Title: First time using AutoFac - Cannot resolve IDataContext in HomeController Question: I'm new to AutoFac and I'm facing an issue resolving dependencies for my HomeController which depends on ...
Daniel Meggs's user avatar
0 votes
0 answers
13 views

Is it possible to use Metdata Attribute for generic interface implemenations?

For below IMyInterface implementation is it possible to get meta data ienumerable as IEnumerable<Meta<IMyInterface<IGenericType>>> MetdataList { get; set; } public interface ...
Manjusha's user avatar
0 votes
0 answers
20 views

Autofac Generics Registration

I have one c# project which is using libraries from Ardalis Specification , I need to work with two different DbContext. So, from Autofac side I need to register generics which will implement ...
Danijel Boksan's user avatar
0 votes
1 answer
15 views

how to inject component to constructor parameter using configuration file

I'm trying to inject constructor parameters using a configuration file, but it seems autofac only supports builtin primitive types, any suggestions? thanks following is the code { "...
user2956246's user avatar
0 votes
0 answers
14 views

How can Autofac implement attribute-based property injection?

To implement attribute-based dependency injection in a C# console application using Autofac, and to specify that this attribute should inject an object with the key "xxx", how should I do it?...
user25631590's user avatar
0 votes
0 answers
19 views

Attempt by security transparent method Autofac.Integration.Mvc.RegistrationExtensions

Attempt by security transparent method Autofac.Integration.Mvc.RegistrationExtensions.RegisterControllers(Autofac.ContainerBuilder, System.Reflection.Assembly[])' to access security critical type '...
Utkarsh Srivastava's user avatar
0 votes
0 answers
19 views

Autofac 8.0 throws error on IIndex<dataprovider, func<IDbContext>>

Actual class and its registration shown in below block Repository with passing param as IIndex public CycleDetailsMaintenanceRepositoryProvider(IIndex<DataProvider, Func<IDbContext>> ...
jimi shah's user avatar
0 votes
0 answers
45 views

Runtime registration, register a new instance on runtime. (autofac)

I use DI to decouple some services from the rest of the application. I register them at the composition root of the project and read their configurations from the database. I would like to implement a ...
Sohrab Sardari's user avatar
0 votes
0 answers
24 views

Autofac delegate factory with optional parameters

I am trying to create a delegate factory in autofac that allows for some parameters to be avoided. My idea is to register a class with registration parameters and be able to override it in the ...
elgato's user avatar
  • 536

15 30 50 per page
1
2 3 4 5
289