예제 #1
0
        private void Register(ContainerAdapter adapter)
        {
            adapter.RegisterInstance(RouteTable.Routes)
            .RegisterInstance(BuildManager)
            .RegisterAsSingleton <IFilterRegistry, FilterRegistry>()
            .RegisterAsSingleton <IFilterProvider, FilterProvider>()
            .RegisterAsSingleton <IModelMetadataRegistry, ModelMetadataRegistry>();

            BuildManager.ConcreteTypes
            .Where(type => KnownTypes.BootstrapperTaskType.IsAssignableFrom(type))
            .Each(type => adapter.RegisterAsSingleton(type));

            BuildManager.ConcreteTypes
            .Where(type => KnownTypes.PerRequestTaskType.IsAssignableFrom(type))
            .Each(type => adapter.RegisterAsPerRequest(type));

            adapter.RegisterInstance <IServiceRegistrar>(adapter)
            .RegisterInstance <IDependencyResolver>(adapter)
            .RegisterInstance <IServiceInjector>(adapter)
            .RegisterInstance(adapter)
            .RegisterInstance(BootstrapperTasks)
            .RegisterInstance(PerRequestTasks)
            .RegisterInstance(new TypeMappingRegistry <Controller, IActionInvoker>())
            .RegisterInstance(new TypeMappingRegistry <Controller, IControllerActivator>())
            .RegisterInstance(new TypeMappingRegistry <IView, IViewPageActivator>())
            .RegisterInstance(new TypeMappingRegistry <object, IModelBinder>());
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FilterRegistry"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public FilterRegistry(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
            items     = new List <FilterRegistryItem>();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedViewPageActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="viewActivatorRegistry">The view activator registry.</param>
        public ExtendedViewPageActivator([NotNull] ContainerAdapter container, [NotNull] TypeMappingRegistry <IView, IViewPageActivator> viewActivatorRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(viewActivatorRegistry, "viewActivatorRegistry");

            Container             = container;
            ViewActivatorRegistry = viewActivatorRegistry;
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedModelBinderProvider"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="modelBinderRegistry">The model binder registry.</param>
        public ExtendedModelBinderProvider(ContainerAdapter container, TypeMappingRegistry <object, IModelBinder> modelBinderRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(modelBinderRegistry, "modelBinderRegistry");

            Container           = container;
            ModelBinderRegistry = modelBinderRegistry;
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedModelBinderProvider"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="modelBinderRegistry">The model binder registry.</param>
        public ExtendedModelBinderProvider(ContainerAdapter container, TypeMappingRegistry<object, IModelBinder> modelBinderRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(modelBinderRegistry, "modelBinderRegistry");

            Container = container;
            ModelBinderRegistry = modelBinderRegistry;
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedViewPageActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="viewActivatorRegistry">The view activator registry.</param>
        public ExtendedViewPageActivator(ContainerAdapter container, TypeMappingRegistry<IView, IViewPageActivator> viewActivatorRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(viewActivatorRegistry, "viewActivatorRegistry");

            Container = container;
            ViewActivatorRegistry = viewActivatorRegistry;
        }
예제 #7
0
        private ContainerAdapter CreateAndSetCurrent()
        {
            ContainerAdapter adapter = CreateAdapter();

            Register(adapter);

            DependencyResolver.SetResolver(adapter);

            return(adapter);
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedControllerActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="controllerActivatorRegistry">The controller activator registry.</param>
        /// <param name="actionInvokerRegistry">The action invoker registry.</param>
        public ExtendedControllerActivator(ContainerAdapter container, TypeMappingRegistry <Controller, IControllerActivator> controllerActivatorRegistry, TypeMappingRegistry <Controller, IActionInvoker> actionInvokerRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(controllerActivatorRegistry, "controllerActivatorRegistry");
            Invariant.IsNotNull(actionInvokerRegistry, "actionInvokerRegistry");

            Container = container;
            ControllerActivatorRegistry = controllerActivatorRegistry;
            ActionInvokerRegistry       = actionInvokerRegistry;
        }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedControllerActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="controllerActivatorRegistry">The controller activator registry.</param>
        /// <param name="actionInvokerRegistry">The action invoker registry.</param>
        public ExtendedControllerActivator(ContainerAdapter container, TypeMappingRegistry<Controller, IControllerActivator> controllerActivatorRegistry, TypeMappingRegistry<Controller, IActionInvoker> actionInvokerRegistry)
        {
            Invariant.IsNotNull(container, "container");
            Invariant.IsNotNull(controllerActivatorRegistry, "controllerActivatorRegistry");
            Invariant.IsNotNull(actionInvokerRegistry, "actionInvokerRegistry");

            Container = container;
            ControllerActivatorRegistry = controllerActivatorRegistry;
            ActionInvokerRegistry = actionInvokerRegistry;
        }
        public static FilterInfo Merge(ContainerAdapter container, FilterInfo decoratedFilters, FilterInfo registeredFilters)
        {
            Inject(container, decoratedFilters);

            FilterInfo mergedFilters = new FilterInfo();

            MergeOrdered(mergedFilters, decoratedFilters, registeredFilters);
            MergeUnordered(mergedFilters, decoratedFilters, registeredFilters);

            return(mergedFilters);
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterViews"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterViews(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterModelBinderProvider"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterModelBinderProvider(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterModelBinderProvider"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterModelBinderProvider(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterControllerActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterViewPageActivator(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterActionInvokers"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterActionInvokers(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
예제 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterModelMetadata"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterModelMetadata(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterModelMetadata"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterModelMetadata(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedControllerActionInvoker"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public ExtendedControllerActionInvoker(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
예제 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterControllerActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterControllerActivator([NotNull] ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
 public UnityCallInterceptorRegistry(ContainerAdapter container)
     : base(container)
 {
 }
예제 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterControllerActivator"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterViewPageActivator(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterValueProviderFactories"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterValueProviderFactories(ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedControllerActionInvoker"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public ExtendedControllerActionInvoker([NotNull] ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }
예제 #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterFilters"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public RegisterFilters([NotNull] ContainerAdapter container)
        {
            Invariant.IsNotNull(container, "container");

            Container = container;
        }