Autofac.Multitenant 8.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Autofac.Multitenant --version 8.0.2                
NuGet\Install-Package Autofac.Multitenant -Version 8.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Autofac.Multitenant" Version="8.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Autofac.Multitenant --version 8.0.2                
#r "nuget: Autofac.Multitenant, 8.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Autofac.Multitenant as a Cake Addin
#addin nuget:?package=Autofac.Multitenant&version=8.0.2

// Install Autofac.Multitenant as a Cake Tool
#tool nuget:?package=Autofac.Multitenant&version=8.0.2                

Autofac.Multitenant

Multitenant application support for Autofac IoC.

Build status codecov

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

BREAKING CHANGE: As of v4.0.0, the Autofac.Extras.Multitenant package is Autofac.Multitenant.

Quick Start

// First, create your application-level defaults using a standard
// ContainerBuilder, just as you are used to.
var builder = new ContainerBuilder();
builder.RegisterType<Consumer>()
  .As<IDependencyConsumer>()
  .InstancePerDependency();
builder.RegisterType<BaseDependency>()
  .As<IDependency>()
  .SingleInstance();
var appContainer = builder.Build();

// Once you've built the application-level default container, you
// need to create a tenant identification strategy that implements
// ITenantIdentificationStrategy. This is how the container will
// figure out which tenant is acting and needs dependencies resolved.
var tenantIdentifier = new MyTenantIdentificationStrategy();

// Now create the multitenant container using the application
// container and the tenant identification strategy.
var mtc = new MultitenantContainer(tenantIdentifier, appContainer);

// Configure the overrides for each tenant by passing in the tenant ID
// and a lambda that takes a ContainerBuilder.
mtc.ConfigureTenant(
  '1',
  b => b.RegisterType<Tenant1Dependency>()
    .As<IDependency>()
    .InstancePerDependency());
mtc.ConfigureTenant(
  '2',
  b => b.RegisterType<Tenant2Dependency>()
    .As<IDependency>()
    .SingleInstance());

// Now you can use the multitenant container to resolve instances.

Check out the documentation for more usage details.

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Autofac.Multitenant:

Package Downloads
Autofac.AspNetCore.Multitenant

Multitenant Autofac container integration support for ASP.NET Core.

Autofac.Multitenant.Wcf

Multitenant applications allow individual tenants to override dependencies rather than having a simple root container for everyone. This extension provides support for an application container and tenant-specific overrides using Autofac when hosting WCF services.

mg.core.project

Core assembly for my project.

Mg.Core.Mvc.Project

Core assembly for MVC project.

Mg.Core.WebApi.Project

Core assembly for WebApi project.

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Autofac.Multitenant:

Repository Stars
autofac/Examples
Example projects that consume and demonstrate Autofac IoC functionality and integration
yc-l/yc.boilerplate
YC. Boilerplate is a set of loose coupling, flexible combination, complete functions, convenient development, and reduces the workload of development.
autofac/Autofac.AspNetCore.Multitenant
Enables multitenant dependency injection support for ASP.NET Core.
Version Downloads Last updated
8.1.0 890 12/4/2024
8.0.3 87,209 4/1/2024
8.0.2 126,108 3/12/2024
8.0.1 55,544 1/28/2024
8.0.0 6,192 1/18/2024
7.0.1 89,721 8/24/2023
7.0.0 272,730 3/8/2023
6.0.0 2,193,766 9/28/2020
5.0.1 450,059 4/7/2020
5.0.0 284,748 1/28/2020
4.2.0 651,297 8/28/2017
4.1.0 5,220 8/16/2017
4.0.0 255,016 8/9/2016
4.0.0-rc3-226 1,110 6/28/2016
4.0.0-beta8-219 1,991 9/10/2015
4.0.0-beta8-216 1,040 9/9/2015
4.0.0-beta7-222 1,181 9/11/2015