private static void RegisterWebApiSpecificDependencies(Container container)
        {
            container.RegisterSingleton<IPrincipal>(new HttpContextPrincipal());
            container.RegisterSingleton<ILogger, DebugLogger>();
            container.RegisterSingleton<IQueryProcessor, DynamicQueryProcessor>();

            // This provider builds the list of commands and queries.
            var provider = new CommandControllerDescriptorProvider(typeof(ICommandHandler<>).Assembly);

            container.RegisterSingleton<CommandControllerDescriptorProvider>(provider);

            container.RegisterSingleton<IHttpControllerSelector, CommandHttpControllerSelector>();
            container.RegisterSingleton<IHttpActionSelector, CommandHttpActionSelector>();

            // This line is optional, but by registering all controllers explicitly, they will be
            // verified when calling Verify().
            foreach (var commandDescriptor in provider.GetDescriptors())
            {
                container.Register(commandDescriptor.ControllerDescriptor.ControllerType);
            }
        }
 public CommandHttpControllerSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
     : base(GlobalConfiguration.Configuration)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
 public HomeController(CommandControllerDescriptorProvider descriptorProvider)
 {
     this.descriptorProvider = descriptorProvider;
 }
Exemple #4
0
 public CommandHttpActionSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
 public CommandHttpActionSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
 public CommandHttpControllerSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
     : base(GlobalConfiguration.Configuration)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }