コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public CommandHttpControllerSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
     : base(GlobalConfiguration.Configuration)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
コード例 #3
0
 public HomeController(CommandControllerDescriptorProvider descriptorProvider)
 {
     this.descriptorProvider = descriptorProvider;
 }
コード例 #4
0
 public CommandHttpActionSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
コード例 #5
0
 public CommandHttpActionSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }
コード例 #6
0
 public CommandHttpControllerSelector(CommandControllerDescriptorProvider controllerDescriptorProvider)
     : base(GlobalConfiguration.Configuration)
 {
     this.controllerDescriptorProvider = controllerDescriptorProvider;
 }