autofac / Autofac.Mvc

ASP.NET MVC integration for Autofac
MIT License
49 stars 23 forks source link

Add factory/accessor function for AutofacDependencyResolver.Current #2

Closed tillig closed 8 years ago

tillig commented 9 years ago

It doesn't seem we can win on the way we get AutofacDependencyResolver.Current - whether it's registered in a lifetime scope or unwound from the currently set resolver.

By default, the current behavior is great, but for folks who still need to do some sort of unsupported decoration, we should offer a way to override the default behavior. A sort of factory method/function that is used to retrieve the resolver could help.

public void SetCurrentResolverAccessor(Func<AutofacDependencyResolver> accessor)

Set it to null to return to the default behavior; otherwise set it to something specific to take control of how to get the current Autofac dependency resolver.

tillig commented 8 years ago

Added. This will be in the 4.0 release.