protected override void Load(ContainerBuilder builder)
        {
            builder.Register(c => new AutofacServiceLocator(c)).As<IServiceLocator>().ContainerScoped();
            builder.Register(namingConventions).ExternallyOwned();
            builder.Register(c => new DefaultActionMethodSelector()).As<IActionMethodSelector>();

            var actionTypes = new ControllerActionLocator(namingConventions)
                .FindActionsFromAssemblyContaining<Index>()
                .Where(x => x.Namespace.StartsWith("Web.Controllers"));

            foreach(var action in actionTypes) {
                builder.Register(action.Type).FactoryScoped().Named(action.Name);
            }

            ConfigureFilters(builder);
        }
        protected override void Load(ContainerBuilder builder)
        {
            builder.Register(c => new AutofacServiceLocator(c)).As <IServiceLocator>().ContainerScoped();
            builder.Register(namingConventions).ExternallyOwned();
            builder.Register(c => new DefaultActionMethodSelector()).As <IActionMethodSelector>();

            var actionTypes = new ControllerActionLocator(namingConventions)
                              .FindActionsFromAssemblyContaining <Index>()
                              .Where(x => x.Namespace.StartsWith("Web.Controllers"));

            foreach (var action in actionTypes)
            {
                builder.Register(action.Type).FactoryScoped().Named(action.Name);
            }

            ConfigureFilters(builder);
        }
 public void Setup()
 {
     locator = new ControllerActionLocator(new DefaultNamingConventions());
 }
Esempio n. 4
0
 public void Setup()
 {
     locator = new ControllerActionLocator(new DefaultNamingConventions());
 }