![]() |
VOOZH | about |
dotnet add package Autofac.Configuration --version 8.0.0
NuGet\Install-Package Autofac.Configuration -Version 8.0.0
<PackageReference Include="Autofac.Configuration" Version="8.0.0" />
<PackageVersion Include="Autofac.Configuration" Version="8.0.0" />Directory.Packages.props
<PackageReference Include="Autofac.Configuration" />Project file
paket add Autofac.Configuration --version 8.0.0
#r "nuget: Autofac.Configuration, 8.0.0"
#:package Autofac.Configuration@8.0.0
#addin nuget:?package=Autofac.Configuration&version=8.0.0Install as a Cake Addin
#tool nuget:?package=Autofac.Configuration&version=8.0.0Install as a Cake Tool
Configuration support for Autofac.
👁 Build status
👁 codecov
👁 NuGet
Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.
The basic steps to getting configuration set up with your application are:
Microsoft.Extensions.Configuration.
Microsoft.Extensions.Configuration.JsonMicrosoft.Extensions.Configuration.XmlMicrosoft.Extensions.Configuration.ConfigurationBuilder.Autofac.Configuration.ConfigurationModule and pass the built Microsoft.Extensions.Configuration.IConfiguration into it.Autofac.Configuration.ConfigurationModule with your container.A configuration file with some simple registrations looks like this:
{
"defaultAssembly": "Autofac.Example.Calculator",
"components": [{
"type": "Autofac.Example.Calculator.Addition.Add, Autofac.Example.Calculator.Addition",
"services": [{
"type": "Autofac.Example.Calculator.Api.IOperation"
}],
"injectProperties": true
}, {
"type": "Autofac.Example.Calculator.Division.Divide, Autofac.Example.Calculator.Division",
"services": [{
"type": "Autofac.Example.Calculator.Api.IOperation"
}],
"parameters": {
"places": 4
}
}]
}
JSON is cleaner and easier to read, but if you prefer XML, the same configuration looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<autofac defaultAssembly="Autofac.Example.Calculator">
<components name="0">
<type>Autofac.Example.Calculator.Addition.Add, Autofac.Example.Calculator.Addition</type>
<services name="0" type="Autofac.Example.Calculator.Api.IOperation" />
<injectProperties>true</injectProperties>
</components>
<components name="1">
<type>Autofac.Example.Calculator.Division.Divide, Autofac.Example.Calculator.Division</type>
<services name="0" type="Autofac.Example.Calculator.Api.IOperation" />
<injectProperties>true</injectProperties>
<parameters>
<places>4</places>
</parameters>
</components>
</autofac>
Note the ordinal "naming" of components and services in XML - this is due to the way Microsoft.Extensions.Configuration handles ordinal collections (arrays).
Build up your configuration and register it with the Autofac ContainerBuilder like this:
// Add the configuration to the ConfigurationBuilder.
var config = new ConfigurationBuilder();
// config.AddJsonFile comes from Microsoft.Extensions.Configuration.Json
// config.AddXmlFile comes from Microsoft.Extensions.Configuration.Xml
config.AddJsonFile("autofac.json");
// Register the ConfigurationModule with Autofac.
var module = new ConfigurationModule(config.Build());
var builder = new ContainerBuilder();
builder.RegisterModule(module);
Check out the Autofac configuration documentation for more information.
Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Autofac.Configuration:
| Package | Downloads |
|---|---|
|
Autofac.Extras.AboditNLP
AboditNLP integration for Autofac |
|
|
Baseclass.Contrib.SpecFlow.Selenium.NUnit
Configures SpecFlow to be able to easily use Selenium for WebTesting. Makes it possible to annotate a scenario with the browser it's supposed to work with. Contains SauceLabs IWebDriver implementation which has utility methods to update test status. |
|
|
Unickq.SpecFlow.Selenium
Test class generator to drive automated web ui tests with Selenium and SpecFlow 2.4 Works with BrowserStack, SauceLabs, TestingBot, CrossbrowserTesting and any WebDriver grid. Based on Baseclass.Contrib.SpecFlow.Selenium.NUnit. |
|
|
Oxygen
a sample rpc framework from .net core + k8s |
|
|
Gaia.Core.IoC.Autofac
Package Description |
Showing the top 8 popular GitHub repositories that depend on Autofac.Configuration:
| Repository | Stars |
|---|---|
|
OrchardCMS/Orchard
Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform. Check out the next generation of this software built on ASP.NET Core: https://github.com/OrchardCMS/OrchardCore
|
|
|
microsoft/dotnet-apiport
This repo contains .NET Portability Analyzer (VSIX and Console) libraries and tools
|
|
|
optimajet/WorkflowEngine.NET
WorkflowEngine.NET - component that adds workflow in your application. It can be fully integrated into your application, or be in the form of a specific service (such as a web service).
|
|
|
ivanpaulovich/hexagonal-architecture-acerola
An Hexagonal Architecture service template with DDD, CQRS, TDD and SOLID using .NET Core 2.0. All small features are testable and could be mocked. Adapters could be mocked or exchanged.
|
|
|
autofac/Examples
Example projects that consume and demonstrate Autofac IoC functionality and integration
|
|
|
ivanpaulovich/event-sourcing-jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
|
|
|
ivanpaulovich/clean-architecture-webapi-ef-core
:heart: The simplest Clean Architecture demo on how to implement a Web Api using .NET Core and Entity Framework
|
|
|
Particular/docs.particular.net
All content for ParticularDocs
|
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.0 | 211 | 6/17/2026 |
| 7.0.0 | 1,863,442 | 7/13/2024 |
| 6.0.0 | 8,721,679 | 9/28/2020 |
| 5.1.0 | 726,388 | 2/19/2020 |
| 5.0.0 | 75,161 | 1/30/2020 |
| 4.1.0 | 1,991,771 | 6/21/2018 |
| 4.0.1 | 1,290,625 | 9/7/2016 |
| 4.0.0 | 92,422 | 8/9/2016 |
| 4.0.0-rc3-289 | 1,863 | 6/28/2016 |
| 4.0.0-rc2-286 | 1,563 | 6/28/2016 |
| 4.0.0-rc2-281 | 1,738 | 6/9/2016 |
| 4.0.0-rc2-274 | 1,732 | 6/8/2016 |
| 4.0.0-rc1-268 | 3,267 | 11/20/2015 |
| 4.0.0-beta8-262 | 2,002 | 10/22/2015 |
| 4.0.0-beta7-252 | 1,877 | 9/8/2015 |
| 4.0.0-beta6-248 | 2,671 | 8/5/2015 |
| 3.3.0 | 1,416,519 | 7/9/2014 |
| 3.2.1 | 190,602 | 3/27/2014 |
| 3.2.0 | 63,489 | 12/17/2013 |
| 3.1.0 | 112,497 | 7/12/2013 |
Release notes are at https://github.com/autofac/Autofac.Configuration/releases