Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }