I am using the Nuget MVC3 integration package for Autofac with MVC4. It works mostly (embedding a constructor with controllers works fine), but it does not enter registered services into the properties of the action filter.
This is my registration at Global.asax.cs:
builder.RegisterType<AspNetMembershipProviderWrapper>().As(typeof(IUserService)).InstancePerHttpRequest();
builder.RegisterType<SetCultureAttribute>().As<IActionFilter>().PropertiesAutowired().SingleInstance();
builder.RegisterFilterProvider();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
Then in SetCultureAttributeI have this:
public IUserService _userService { get; set; }
And this does not work in the attribute constructor:
_userService = DependencyResolver.Current.GetService<AspNetMembershipProviderWrapper>(); // always returns null
DependencyResolver.Current.GetService() also returns null for all other registered services when called in the constructor of the action filter (I tried it in Debug windows to check it).
So, I think something is not working correctly. Is it possible to use MVC3 integration or use the Nuget MVC4 package (which says this for RC)?
Is there anything else that I could try to make this work?