Bump Autofac from 5.2.0 to 6.0.0
Bumps Autofac from 5.2.0 to 6.0.0.
Release notes
Sourced from Autofac's releases.
v6.0.0
Version 6.0.0 represents a major update in the Autofac internals. While every effort has been made to ensure code using version 5.x will continue to work exactly as you expect, you should be aware of the breaking changes and test things out. For the majority case, things should just continue to work; breaking changes are primarily in more rare advanced usage scenarios.
Check out the release blog post! Also, the documentation has been updated and is ready!
⚠ Starting with Autofac 6.0, we now only targetnetstandard20
andnetstandard21
; we have removed the explicit target fornet461
.The impact to you is that, while Autofac will still work on .NET Framework 4.6.1 as it did before, we strongly encourage you to upgrade to .NET Framework 4.7.2 or higher, as per the .NET Standard Documentation, to avoid any of the known dependency issues when using .NET Standard packages in .NET Framework 4.6.1.
New Features
There are a lot of new features, but the big ones are here. Other features and fixes will be outlined in the Issues section, below.
- Pipelines: This is the major change in Autofac v6 - all resolution activities internally now flow through pipelines, similar to how ASP.NET Core requests flow through pipelines. This allows for better customization in how things get resolved as well as enabling support for more new features.
- Composites: The composite pattern allows a collection of objects to be treated as though it's a single object.
- Diagnostics: Autofac v6 adds support for
DiagnosticSource
diagnostics. The core Autofac package ships with a default text-based diagnostic tracer and the newAutofac.Diagnostics.DotGraph
package adds graphic tracing using DOT and Graphviz.- Generic Delegate Registrations: You can now register an open generic associated with a delegate/lambda expression, allowing you to provide a custom factory to resolve generics just like you do with non-generic types.
- Concurrency Performance Improvements: We focused a lot on performance and have removed a lot of locking. In some highly-concurrent cases, we've seen a 4x speed increase.
Issues and PRs
The following issues have been addressed in v6:
- #718: Circular dependency support using property injection and relationships like
Lazy<T>
should now work.- #788: DOT graph support has been added via the
Autofac.Diagnostics.DotGraph
package.- #798 / #1148: Circular dependency handling uses the .NET runtime to check stack depth when checking for circular dependencies rather than using a fixed stack depth.
- #828: The
ILifetimeScope.LifetimeScopeEnding
event is raised and completes before the scope is disposed.- #970: The composite pattern is now supported.
- #1069 / #1172: Core Autofac events are now async-friendly.
- #1120 / #1128:
ContainerBuilder
is nowsealed
.- #1123: Explicitly injected properties can now be declared using an expression.
- #1126 / #1169: Diagnostics are handled via
DiagnosticSource
.- #1162: A new "pooled" lifetime type has been added via the
Autofac.Pooling
package.Breaking Changes
We'll do our best to keep an upgrade guide with breaking changes available and up to date. We're pretty sure we caught them all, but if you find a gotcha, let us know on the Documentation repo.
A summary of the breaking changes is as follows:
... (truncated)
net461
is no longer targeted; Autofac now targetsnetstandard2.0
andnetstandard2.1
.IConstructorSelector
implementations need to switch to useBoundConstructor
instead ofConstructorParameterBinding
.IRegistrationSource
implementations need to update theRegistrationsFor
method signature.IInstanceActivator
implementations no longer have anActivateInstance
method and instead have aConfigurePipeline
method.RegistrationBuilder.RegistrationData
no longer exposes activation handlers. TheCoreEventMiddleware
is the source of events now.IComponentRegistration
no longer exposes activation events. TheCoreEventMiddleware
is the source of events now.IComponentRegistry
no longer supplies aDecoratorsFor
method to check decorators. UseIComponentRegistry.ServiceMiddlewareFor
instead.ContainerBuilder
is nowsealed
.- The
ResolveRequest
constructor now takes aServiceRegistration
instead of anIComponentRegistration
.
Commits
-
39696a9
Merge pull request #1205 from alistairjevans/develop -
6cd646c
Fix #1204 - Capture instance at the point of injection, rather than using the... -
0aa6e7a
Merge pull request #1202 from alistairjevans/develop -
3821f58
Fixes #1201; add OperationSucceeded flag to OperationTraceCompletedArgs. -
4f3be18
Issue #880: Removed skipped test, added test for new decorator syntax. -
46e8503
Test for #718 passes under v6. -
d20dc41
Header fixes. -
4ad7121
Header fixes. -
38ef391
Enable StyleCop to check for source file headers. -
db5428b
Fixes for 'delegate can be simplified.' - Additional commits viewable in compare view