Autofac.ServiceFabric
5.0.0
Prefix Reserved
dotnet add package Autofac.ServiceFabric --version 5.0.0
NuGet\Install-Package Autofac.ServiceFabric -Version 5.0.0
<PackageReference Include="Autofac.ServiceFabric" Version="5.0.0" />
<PackageVersion Include="Autofac.ServiceFabric" Version="5.0.0" />
<PackageReference Include="Autofac.ServiceFabric" />
paket add Autofac.ServiceFabric --version 5.0.0
#r "nuget: Autofac.ServiceFabric, 5.0.0"
#:package Autofac.ServiceFabric@5.0.0
#addin nuget:?package=Autofac.ServiceFabric&version=5.0.0
#tool nuget:?package=Autofac.ServiceFabric&version=5.0.0
Autofac.ServiceFabric
Service Fabric support for Autofac.
Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.
Quick Start
In your Main program method, build up your container and register services using the Autofac extensions. This will attach service registrations from the container and the ServiceRuntime. Dispose of the container at app shutdown.
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using Autofac;
using Autofac.Integration.ServiceFabric;
namespace DemoService
{
public static class Program
{
private static void Main()
{
try
{
// The ServiceManifest.xml file defines one or more service type names.
// Registering a service maps a service type name to a .NET type.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
// Start with the trusty old container builder.
var builder = new ContainerBuilder();
// Register any regular dependencies.
builder.RegisterModule(new LoggerModule(ServiceEventSource.Current.Message));
// Register the Autofac magic for Service Fabric support.
builder.RegisterServiceFabricSupport();
// Register a stateless service...
builder.RegisterStatelessService<DemoStatelessService>("DemoStatelessServiceType");
// ...and/or register a stateful service.
// builder.RegisterStatefulService<DemoStatefulService>("DemoStatefulServiceType");
using (builder.Build())
{
ServiceEventSource.Current.ServiceTypeRegistered(
Process.GetCurrentProcess().Id,
typeof(DemoStatelessService).Name);
// Prevents this host process from terminating so services keep running.
Thread.Sleep(Timeout.Infinite);
}
}
catch (Exception e)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
throw;
}
}
}
}
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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. |
-
.NETStandard 2.0
- Autofac (>= 9.3.2)
- Autofac.Extras.DynamicProxy (>= 8.1.0)
- Microsoft.ServiceFabric.Actors (>= 8.0.0)
- Microsoft.ServiceFabric.Services (>= 8.0.0)
-
.NETStandard 2.1
- Autofac (>= 9.3.2)
- Autofac.Extras.DynamicProxy (>= 8.1.0)
- Microsoft.ServiceFabric.Actors (>= 8.0.0)
- Microsoft.ServiceFabric.Services (>= 8.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Autofac.ServiceFabric:
| Package | Downloads |
|---|---|
|
SFA.DAS.Payments.ServiceFabric.Core
Package Description |
|
|
Cogito.ServiceFabric.Autofac
Microsoft Service Fabric core libraries. |
|
|
SFA.DAS.Payments.JobContextMessageHandling
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Autofac.ServiceFabric:
| Repository | Stars |
|---|---|
|
autofac/Examples
Example projects that consume and demonstrate Autofac IoC functionality and integration
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 166 | 8/19/2026 |
| 4.0.0 | 703,044 | 10/29/2020 |
| 3.0.0 | 180,757 | 2/13/2020 |
| 2.2.0 | 145,047 | 3/14/2019 |
| 2.1.0 | 54,279 | 10/27/2018 |
| 2.0.0 | 114,362 | 2/26/2018 |
| 1.1.0 | 8,703 | 1/18/2018 |
| 1.0.0 | 9,196 | 10/2/2017 |
| 1.0.0-beta2 | 2,067 | 8/6/2017 |
| 1.0.0-beta1 | 7,426 | 5/16/2017 |
| 1.0.0-alpha3 | 2,146 | 4/12/2017 |
| 1.0.0-alpha2 | 1,360 | 4/5/2017 |
| 1.0.0-alpha1 | 1,438 | 3/13/2017 |
Release notes are at https://github.com/autofac/Autofac.ServiceFabric/releases