Exemplo n.º 1
0
        public override async Task Invoke(IOwinContext context)
        {
            IAutofacDependencyManager childDependencyManager = new AutofacDependencyManager();

            childDependencyManager.UseContainer(context.GetAutofacLifetimeScope());

            context.Set <IDependencyResolver>("DependencyResolver", (IDependencyResolver)childDependencyManager);

            await Next.Invoke(context);
        }
        public override Task Invoke(IOwinContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            IAutofacDependencyManager childDependencyManager = new AutofacDependencyManager();

            childDependencyManager.UseContainer(context.GetAutofacLifetimeScope());

            context.Set("DependencyResolver", (IDependencyResolver)childDependencyManager);

            return(Next.Invoke(context));
        }