/// <summary> /// Registers Autocore into MVC from the specified Autofac container (i.e. scope). /// </summary> public static IContainer CreateFromScope(ILifetimeScope scope) { var container = new Autocore.Implementation.Container(scope); DependencyResolver.SetResolver(new AutofacDependencyResolver(scope, new VolatileScopeProvider(scope))); return(container); }
/// <summary> /// Registers Autocore into the WepApi configuration from the specified Autofac container (i.e. scope). /// </summary> public static IContainer RegisterAutocore(this HttpConfiguration config, ILifetimeScope scope) { var container = new Autocore.Implementation.Container(scope); config.DependencyResolver = container.Resolve <Autocore.WebApi.DependencyResolver>(); config.MessageHandlers.Add(container.Resolve <Autocore.WebApi.VolatileHandler>()); return(container); }