Questions tagged [autofac-configuration]
88 questions
0
votes
0 answers
Autofac - Configure Module List-Property with object
I want to configure per XML a module with a property, which contains a list of class MyObject.
My Module and MyObject class are looking like:
public class MyModule : Module
{
public IList MyObjects { get; set; }
protected override…

der_chirurg
- 1,475
- 2
- 16
- 26
0
votes
1 answer
Autofac - How to resolve instances registered using JSON Configuration
Our requirement is to have different Logger instances for different user defined threads.
{
"defaultAssembly": "Framework",
"components": [
{
"type": "SynapseMiddleware.Core.Framework.LoggerServicePerContext, Framework",
"services": [
{
…

Fra
- 21
- 7
0
votes
0 answers
Autofac registration - For user defined thread
In our project, we have multiple threads running in parallel. SO for each customer we have respective thread for them. Currently we have an application level logging, using Serilog, where logs for all the threads are written into one folder. We are…

Fra
- 21
- 7
0
votes
1 answer
Autofac how to update registration?
From the Autofac documentation:
Autofac overrides component registrations by default. This means that an application can register all of its default components, then read an associated configuration file to override any that have been customized…

Horosho
- 647
- 1
- 8
- 22
0
votes
2 answers
Constructor list/array type parameters in the XML configuration
How can I pass an array/list parameter to the class constructor using the XML configuration?
If I want to pass a scalar value I use following configuration:
XXX, XXX

arnam
- 1
- 1
0
votes
1 answer
Skip unknown autofac modules configured in autofac.json
My application is initialized from autofac.json file:
{
"defaultAssembly": "Application",
"modules": [
{ "type": "Application.Plugin1.Module, Application.Plugin1" },
{ "type": "Application.Plugin2.Module,…

Dumitru
- 833
- 3
- 12
- 26
0
votes
2 answers
Pass info about the client to the dependency
Suppose I have an utility (e.g. a logger) that might be used by every class in my app. I want the logger to be able to save the information about the client type that uses the logger i.e. if a StockProvider wants to log a message, the logger should…

patryk
- 651
- 12
- 30
0
votes
1 answer
How to register an autofac decorator for a generic object for CQRS
is the implementations of CQRS:
public interface IQuery {}
public interface IQueryHandler
where TQuery : IQuery
{
Task HandleAsync(TQuery query);
}
public interface IQueryDispatcher
{
…

Edwok
- 3
- 3
0
votes
1 answer
IoC - Autofac and register multiple services with same generic Interface
I have a service layer with the following classes / intefaces (IServices is an empty interface):
public interface IForoChanService : IService
{
T GetById(int id);
IQueryable SearchBy(Expression> predicate);
…

MRFerocius
- 5,509
- 7
- 39
- 47
0
votes
1 answer
Nested list in dictionary property through Autofac.Configuration in JSON
I use Autofac.Configuration but I can't use nested property configuration. The following property NestedListInDictPropThatDoesNotWork is not working:
"type": "Some.Modules.CoolModule, Some.Modules",
"properties": {
"StringProp":…

Beachwalker
- 7,685
- 6
- 52
- 94
0
votes
1 answer
Autofac register same interface with different constructors
I am using latest Autofac and would like to register the same type and interface twice based on different constructors
My class/interface
public partial class MyDbContext : System.Data.Entity.DbContext, IMyDbContext
{
public MyDbContext(string…

David
- 3,047
- 4
- 45
- 79
0
votes
1 answer
Autofac Null reference error web api 2
i am getting "An exception of type 'System.NullReferenceException' occurred in AutoFac Practice.dll but was not handled in user code"
My code and configuration for Autofac is:
Autofac Configuration:
public static class WebApiConfig
{
public…

Sanjay Bathre
- 451
- 1
- 5
- 17
-2
votes
2 answers
Autofac.Core.DependencyResolutionException: Expression of type '' cannot be used for return type 'System.Object' in Autofac 6.2
I have the code here, that used to work in Autofac 2.6, but now no longer works in Autofac 6.2:
class Program
{
static void Main(string[] args)
{
Holder holder = null;
Build(c =>
{
holder = new Holder() {…

Graviton
- 81,782
- 146
- 424
- 602