![]() |
VOOZH | about |
dotnet add package Autofac.Multitenant --version 8.1.0
NuGet\Install-Package Autofac.Multitenant -Version 8.1.0
<PackageReference Include="Autofac.Multitenant" Version="8.1.0" />
<PackageVersion Include="Autofac.Multitenant" Version="8.1.0" />Directory.Packages.props
<PackageReference Include="Autofac.Multitenant" />Project file
paket add Autofac.Multitenant --version 8.1.0
#r "nuget: Autofac.Multitenant, 8.1.0"
#:package Autofac.Multitenant@8.1.0
#addin nuget:?package=Autofac.Multitenant&version=8.1.0Install as a Cake Addin
#tool nuget:?package=Autofac.Multitenant&version=8.1.0Install as a Cake Tool
Multitenant application support for Autofac IoC.
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.
// 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.
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 is compatible. 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 is compatible. 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 was computed. 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.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. |
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 | 253,447 | 12/4/2024 |
| 8.0.3 | 319,960 | 4/1/2024 |
| 8.0.2 | 1,022,597 | 3/12/2024 |
| 8.0.1 | 66,016 | 1/28/2024 |
| 8.0.0 | 22,758 | 1/18/2024 |
| 7.0.1 | 118,376 | 8/24/2023 |
| 7.0.0 | 394,865 | 3/8/2023 |
| 6.0.0 | 3,734,913 | 9/28/2020 |
| 5.0.1 | 484,953 | 4/7/2020 |
| 5.0.0 | 326,612 | 1/28/2020 |
| 4.2.0 | 748,994 | 8/28/2017 |
| 4.1.0 | 8,798 | 8/16/2017 |
| 4.0.0 | 281,980 | 8/9/2016 |
| 4.0.0-rc3-226 | 1,565 | 6/28/2016 |
| 4.0.0-beta8-219 | 2,435 | 9/10/2015 |
| 4.0.0-beta8-216 | 1,499 | 9/9/2015 |
| 4.0.0-beta7-222 | 1,661 | 9/11/2015 |
Release notes are at https://github.com/autofac/Autofac.Multitenant/releases