Questions tagged [autofac-module]
82 questions
0
votes
1 answer
Register type conditionally in Autofac
I have parent class Animal and two child classes Dog and cat. I am using Autofac for dependency injection. I want to register Dog and Cat based on condition that is specified in config file.
I want following code in my module class.
If Dog…

Rashi Garg
- 177
- 1
- 1
- 9
0
votes
1 answer
Autofac module registration tree across layers
So I have a typical three tiered application layered as below
DAL -> Repository -> Business -> Web.UI/API
I have been reading this article about registering dependencies by centralizing them via modules.
The web layer only has a reference to…

user20358
- 14,182
- 36
- 114
- 186
0
votes
0 answers
Creating Instance of a Class using reflection,whose parameters are injected by autofac
I am creating some WCF services in which I am using Autofac as the IOC.
Now I need to create an instance of one of the classes using reflection whose
parameters are injected by Autofac.
But when I use Activator.CreateInstance its giving exception…

Vishnu
- 897
- 6
- 13
0
votes
0 answers
Autofac WCF Integration
I was trying to use the autofac with WCF Integration.
I was using the solution from https://code.msdn.microsoft.com/DI-with-WCF-using-Autofac-a3e8cbbb. I am able to consume the service and call the operations by adding a service reference.But when I…

Vishnu
- 897
- 6
- 13
0
votes
1 answer
Autofac Modules Imported with MEF not being Loaded
I have a number of assemblies, each supplying their dependencies to Autofac through the use of a class that extends Autofac.Module. I have decorated each of these as a MEF export, e.g:
[Export(typeof(IModule))]
public class ContainerModule :…

Richard
- 603
- 5
- 14
0
votes
1 answer
Autofac module registration in ASP.NET WebAPI
Until now I have done type registration inside a class within my MVC project but I am now trying to do it with Modules. My project is structured as follows
Project.Data: contains my entityframework classes and DataContext. I have refactored my…

Obi
- 3,091
- 4
- 34
- 56
0
votes
0 answers
Duplicate Registration with Autofac
We are using Autofac builder.RegisterAssemblyModules(assembly) method to scan for the modules and it works fine. but If a module is depends on the other modules , Then I am seeing duplicate registration happening because the dependent module is…

satish
- 2,425
- 3
- 23
- 40