/// <summary> /// Initializes a module and prepares it to handle requests. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpApplication" /> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application</param> public void Init(HttpApplication context) { context.EndRequest += (sender, e) => { PerWebRequestContainerProvider.DisposeCurrentScope(sender, e); }; }
public void ShouldResolve_Commands_Successfully() { var containerBuilder = new ContainerBuilder(); containerBuilder.RegisterType(typeof(CommandTest)).AsSelf(); ContextScopeProvider.RegisterTypes(containerBuilder); var httpContextMoq = new HttpContextMoq(); var accessor = new Mock<IHttpContextAccessor>(); accessor .Setup(a => a.GetCurrent()) .Returns(() => httpContextMoq.HttpContextBase); var provider = new PerWebRequestContainerProvider(accessor.Object); var resolver = new DefaultCommandResolver(provider); var commandContext = new CommandContextTest(); var command = resolver.ResolveCommand<CommandTest>(commandContext); Assert.IsNotNull(command); Assert.AreEqual(command.Context, commandContext); }
public PageStylesheetProjectionFactory(PerWebRequestContainerProvider containerProvider, IRepository repository) { this.containerProvider = containerProvider; this.repository = repository; }
public FakePageContentProjectionFactory(PerWebRequestContainerProvider containerProvider, IUnitOfWork unitOfWork) : base(containerProvider, unitOfWork) { }
public DefaultWebControllerFactory(PerWebRequestContainerProvider containerProvider) { this.containerProvider = containerProvider; }