Async Actions/Methods using Autofac?

Mar 15, 2012 at 5:14 PM

anyone know how to make an asynchronous action/method for the frame work using autofac?

Mar 22, 2012 at 1:50 PM

Figured this out too...

 

public void AsyncRun<T>(Action<T> action)
{
            Task.Factory.StartNew(delegate
            {
                using (var container = AutofacDependencyResolver.Current.ApplicationContainer.BeginLifetimeScope("httpRequest"))
                {
                    var service = container.Resolve<T>();
                    action(service);
                }
            });
}