Allow the ContainerBuilderOptions to be provided when using the AutofacServiceProviderFactory
alexmg opened this issue · 2 comments
Problem Statement
When using the AutofacServiceProviderFactory
it is not possible to provide the ContainerBuildOptions
for use when building the container. The constructor only accepts an optional Action<ContainerBuilder
parameter for the configuring the container using the ContainerBuilder
.
Desired Solution
Create a constructor overload that accepts the ContainerBuildOptions
and the optional Action<ContainerBuilder>
.
Alternatives You've Considered
There are no extensibility points to replace the current behavior and get the ContainerBuildOptions
to the Build
method.
Additional Context
This is related to a conversion in autofac/Autofac#1215 where I noted that there is a runtime cost to using the IStartable
and AutoActivate
features. The ContainerBuildOptions
is the mechanism to disable that feature but it currently defaults to enabled.
I think that's reasonable. I was thinking it might be nice if there was a way to specify this on the ContainerBuilder
rather than only as a parameter during build. That said, it could be weird if someone tried to change that value on the builder in a BeginLifetimeScope
lambda so maybe that's not feasible.
The ExcludeDefaultModules
option wouldn't make sense for a child lifetime scope even if changing the IgnoreStartableComponents
option did. You would have to split the two options up making it even more confusing.