All Projects → autofac → Autofac.Configuration

autofac / Autofac.Configuration

Licence: MIT license
Configuration support for Autofac IoC

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to Autofac.Configuration

Autofac
An addictive .NET IoC container
Stars: ✭ 3,713 (+10508.57%)
Mutual labels:  netcore, ioc-container, netstandard, autofac
Singularity
A extremely fast ioc container for high performance applications
Stars: ✭ 63 (+80%)
Mutual labels:  netcore, ioc-container, netstandard
Platform Compat
Roslyn analyzer that finds usages of APIs that will throw PlatformNotSupportedException on certain platforms.
Stars: ✭ 250 (+614.29%)
Mutual labels:  netcore, netstandard
Azos
A to Z Sky Operating System / Microservice Chassis Framework
Stars: ✭ 137 (+291.43%)
Mutual labels:  netcore, netstandard
Activelogin.authentication
Support Swedish BankID (svenskt BankID) authentication in .NET.
Stars: ✭ 141 (+302.86%)
Mutual labels:  netcore, netstandard
Docnet
DocNET is as fast PDF editing and reading library for modern .NET applications
Stars: ✭ 128 (+265.71%)
Mutual labels:  netcore, netstandard
Oss.core
.net core下的领域开源电商网站,类库使用的标准库项目,集成微信和支付宝。 暂时还在开发阶段
Stars: ✭ 128 (+265.71%)
Mutual labels:  netcore, netstandard
Swan
Swan stands for Stuff We All Need. Unosquare's collection of C# extension methods and classes.
Stars: ✭ 202 (+477.14%)
Mutual labels:  netcore, netstandard
Raft.net
Implementation of RAFT distributed consensus algorithm among TCP Peers on .NET / .NETStandard / .NETCore / dotnet
Stars: ✭ 112 (+220%)
Mutual labels:  netcore, netstandard
Standard.licensing
Easy-to-use licensing library for .NET Framework, Mono, .NET Core, and Xamarin products
Stars: ✭ 239 (+582.86%)
Mutual labels:  netcore, netstandard
Megaapiclient
MegaApiClient is a C# .Net library to access http://mega.co.nz / http://mega.nz cloud storage and file hosting service.
Stars: ✭ 151 (+331.43%)
Mutual labels:  netcore, netstandard
Ffmediatoolkit
FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
Stars: ✭ 156 (+345.71%)
Mutual labels:  netcore, netstandard
Elmahcore
ELMAH for Net.Standard and Net.Core
Stars: ✭ 127 (+262.86%)
Mutual labels:  netcore, netstandard
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (+245.71%)
Mutual labels:  netcore, netstandard
SharpAudio
Audio playback/capturing engine for C#
Stars: ✭ 139 (+297.14%)
Mutual labels:  netcore, netstandard
Reversemarkdown Net
ReverseMarkdown.Net is a Html to Markdown converter library in C#. Conversion is very reliable since HtmlAgilityPack (HAP) library is used for traversing the Html DOM
Stars: ✭ 116 (+231.43%)
Mutual labels:  netcore, netstandard
Zipstorer
A Pure C# Class to Store Files in Zip
Stars: ✭ 139 (+297.14%)
Mutual labels:  netcore, netstandard
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (+565.71%)
Mutual labels:  netcore, netstandard
Nlua
Bridge between Lua and the .NET.
Stars: ✭ 1,326 (+3688.57%)
Mutual labels:  netcore, netstandard
Mailmergelib
MailMergeLib is a mail message client library which provides comfortable mail merge capabilities for text, inline images and attachments, as well as good throughput and fault tolerance for sending mail messages.
Stars: ✭ 97 (+177.14%)
Mutual labels:  netcore, netstandard

Autofac.Configuration

Configuration support for Autofac.

Build status

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

The basic steps to getting configuration set up with your application are:

  1. Set up your configuration in JSON or XML files that can be read by Microsoft.Extensions.Configuration.
    • JSON configuration uses Microsoft.Extensions.Configuration.Json
    • XML configuration uses Microsoft.Extensions.Configuration.Xml
  2. Build the configuration using the Microsoft.Extensions.Configuration.ConfigurationBuilder.
  3. Create a new Autofac.Configuration.ConfigurationModule and pass the built Microsoft.Extensions.Configuration.IConfiguration into it.
  4. Register the 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.

Get Help

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].