Click here to Skip to main content
15,881,709 members
Everything / Autofac

Autofac

Autofac

Great Reads

by DotNetSteve
A gentle introduction for DI and IOC in the first program most of us have written - Hello World
by Fiyaz Hasan
Learn how dependency injection mechanism has evolved from ASP.NET to ASP.NET Core
by Mark Olbert
An Autofac-based chained/declarative approach to creating an IHostBuilder/IHost and a generalized dependency injection resolver
by levelnis
Send a success message to a View using TempData

Latest Articles

by Mark Olbert
An Autofac-based chained/declarative approach to creating an IHostBuilder/IHost and a generalized dependency injection resolver
by Mark Pelf
We explain DI Pattern, DIP, IoC, DI Container
by Sunny Makode
This is an introductory article about creating an Odata Rest API in collaboration with Entity Framework. We are also going to use Autofac as our IOC container. Also, Repository and Unit of Work pattern will be used for cleaner access of persistence model through our ORM (Entity Framework).
by Sunny Makode
There are several contents available on the internet that talk about injecting dependencies through .svc file's markup [in WCF service application] and it's easy when you have a WCF service application. But, it is equally easy to do that even in your WCF Library project (without .svc).

All Articles

Sort by Score

Autofac 

26 Feb 2016 by DotNetSteve
A gentle introduction for DI and IOC in the first program most of us have written - Hello World
28 Dec 2016 by Fiyaz Hasan
Learn how dependency injection mechanism has evolved from ASP.NET to ASP.NET Core
8 Jan 2023 by Mark Olbert
An Autofac-based chained/declarative approach to creating an IHostBuilder/IHost and a generalized dependency injection resolver
4 Jan 2016 by levelnis
Send a success message to a View using TempData
31 Jan 2017 by Cathy Wun
This is the first part of Building an Employee Tracker using AngularJS and ASP.NET Web API Series.
8 Dec 2019 by Sunny Makode
This is an introductory article about creating an Odata Rest API in collaboration with Entity Framework. We are also going to use Autofac as our IOC container. Also, Repository and Unit of Work pattern will be used for cleaner access of persistence model through our ORM (Entity Framework).
6 Jun 2018 by Gunnar S
Third article in a series of three regarding NServiceBus, WebAPI and Azure Service Fabric
30 Jul 2019 by Sunny Makode
There are several contents available on the internet that talk about injecting dependencies through .svc file's markup [in WCF service application] and it's easy when you have a WCF service application. But, it is equally easy to do that even in your WCF Library project (without .svc).
16 Jan 2014 by koleraba
HiI have a problem which I am not quite sure how to handle. When my application starts, I need to read the configuration file and - based on the data read from the file construct some objects. The objects are constructed using reflection - I look for a most suitable constructor and invoke...
18 Jan 2014 by koleraba
Sorry for the lame question. The solution is obvious but I somehow missed it. To register all interfaces implemented by some instance all one has to do is:builder.RegisterInstance(instance).AsImplementedInterfaces();
13 Jun 2014 by ShacharK
Hey,I have a general framework which contains a lot of assemblies, some are common, some are designed for Server applications, and some for Client applications (Each feature has a base-line library while any application-type-specific extensions are defined in a different assembly). I'm...
3 Sep 2014 by Tesic Goran
We have ASP.NET application where we use Autofac DI framework. The following error comes up:None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'ConcertRu.ApplicationsCore.Services.SessionWebAppService' can be invoked with the available...
29 Sep 2014 by Kurlyan
First thing's first, English is not my language, please forget my language mistakes.My idea:- How to separate business logic & ui to multi dll- How to plug/unplug application plugin when host application is running- How to Building some share dll for (Script, UI control, css)So,...
29 Sep 2014 by Nelek
Step 1) Do a little research. Google is a good start pointStep 2) Start codingStep 3) Compile and use the debug to solve little issuesStep 4) When you get a problem you don't know how to solve but at least you tried it, then come back and ask for something concrete with a snippet of the...
21 Oct 2015 by Jonas Wikström
HelloI have a type registered as IServiceA. The type is dependent upon another service IServiceB in its constructor. Both types registered using Autofac something like this: public static void Configure(ContainerBuilder builder) { ...
27 Aug 2018 by Member 13953081
Autofac IOC always create problem at production server / hosting in Asp.Net Web Site (c#) How to resolve this issue, without changing Trust level? Inheritance security rules violated while overriding member: 'Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(System.Type)'. Security...
19 Sep 2018 by sai sruthi
Hi, I have a doubt. I have a singleton object of an interface defined in the Autofac container. I use this object across my solution. I need to access the interface inside custom authorize attribute and I need to resolve the dependency. What I have tried: I have tried sending it through...
23 Aug 2019 by ravithejag
I want to pass an extra parameter while resolving the dependencies based on the type. please have a look into my code changes private readonly Func _strategyFactory; calling the stratergy pattern to resolve the dependencies based on the Type. return _strategyFactory(...
3 Sep 2022 by Magnus Sydoff
Hello all, I have used Autofac to write a Console application in Net6 for Windows, Ubuntu and Raspberry. I have managed to wire up my dependencies using an external json file for Autofac as shown below. protected override void...
3 Sep 2022 by TimWallace
You could register factories instead of classes with the DI container. Then have the factories create the instance(s) from config file settings.
3 Sep 2022 by Magnus Sydoff
In order to solve the problem I finally ending up writing something like the code below. First some module definitions public static string ModulesFolderName = "Modules"; public interface IModuleDataConfiguration { ...
18 Aug 2014 by Sul Aga
Using Autofac IoC container in MVC application to resolve dependencies. Scenarios included: controller, custom filter and view dependency injection
9 Aug 2022 by Mark Pelf
We explain DI Pattern, DIP, IoC, DI Container
18 Jun 2016 by saurabhsharmacs
15 Aug 2017 by Vaibhav M Nalwad
Resolving Dependencies via Attributes and Reflection
28 Apr 2021 by easpc
I created a windows service with topshelf, mailkit and autofac nuget packages, I followed the topshelf documentation and can debug and install the service flawlesly on my local machine, but when I start to install as a service it on a windows...
28 Apr 2021 by easpc
Thank you Richard! Fortunately it was not that, here is the solution. I copied the entire bin/release folder from my developer machine to the server and then I installed the service.exe.