Esempio n. 1
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;
        }
Esempio n. 2
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;
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        public static TypeMappingRegistry <Controller, IActionInvoker> Register <TActionInvoker>([NotNull] this TypeMappingRegistry <Controller, IActionInvoker> instance, [NotNull] TypeCatalog typeCatalog) where TActionInvoker : IActionInvoker
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(typeCatalog, "typeCatalog");

            IList <Type> controllerTypes = typeCatalog.ToList();

            EnsureControllerTypes(controllerTypes);

            Type actionInvokerType = typeof(TActionInvoker);

            foreach (Type controllerType in controllerTypes)
            {
                instance.Register(controllerType, actionInvokerType);
            }

            return(instance);
        }
Esempio n. 5
0
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TView1">The type of the controller1.</typeparam>
        /// <typeparam name="TView2">The type of the controller2.</typeparam>
        /// <typeparam name="TView3">The type of the controller3.</typeparam>
        /// <typeparam name="TView4">The type of the controller4.</typeparam>
        /// <typeparam name="TViewPageActivator">The type of the controller activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <IView, IViewPageActivator> Register <TView1, TView2, TView3, TView4, TViewPageActivator>(this TypeMappingRegistry <IView, IViewPageActivator> instance)
            where TView1 : IView
            where TView2 : IView
            where TView3 : IView
            where TView4 : IView
            where TViewPageActivator : IViewPageActivator
        {
            Invariant.IsNotNull(instance, "instance");

            Type viewPageActivatorType = typeof(TViewPageActivator);

            instance.Register(typeof(TView1), viewPageActivatorType);
            instance.Register(typeof(TView2), viewPageActivatorType);
            instance.Register(typeof(TView3), viewPageActivatorType);
            instance.Register(typeof(TView4), viewPageActivatorType);

            return(instance);
        }
Esempio n. 6
0
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TView">The type of the view.</typeparam>
        /// <typeparam name="TViewPageActivator">The type of the view page activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <IView, IViewPageActivator> Register <TView, TViewPageActivator>(this TypeMappingRegistry <IView, IViewPageActivator> instance)
            where TView : IView
            where TViewPageActivator : IViewPageActivator
        {
            Invariant.IsNotNull(instance, "instance");

            instance.Register(typeof(TView), typeof(TViewPageActivator));

            return(instance);
        }
Esempio n. 7
0
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TViewPageActivator">The type of the view page activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="typeCatalog">The type catalog.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <IView, IViewPageActivator> Register <TViewPageActivator>(this TypeMappingRegistry <IView, IViewPageActivator> instance, TypeCatalog typeCatalog)
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(typeCatalog, "typeCatalog");

            IList <Type> viewTypes = typeCatalog.ToList();

            EnsureViewTypes(viewTypes);

            Type viewPageActivatorType = typeof(TViewPageActivator);

            foreach (Type viewType in viewTypes)
            {
                instance.Register(viewType, viewPageActivatorType);
            }

            return(instance);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureViewPageActivatorsBase"/> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 protected ConfigureViewPageActivatorsBase([NotNull] TypeMappingRegistry <IView, IViewPageActivator> registry) : base(registry)
 {
 }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TController">The type of the controller.</typeparam>
        /// <typeparam name="TControllerActivator">The type of the controller activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <Controller, IControllerActivator> Register <TController, TControllerActivator>(this TypeMappingRegistry <Controller, IControllerActivator> instance)
            where TController : Controller
            where TControllerActivator : IControllerActivator
        {
            Invariant.IsNotNull(instance, "instance");

            instance.Register(typeof(TController), typeof(TControllerActivator));

            return(instance);
        }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TControllerActivator">The type of the action invoker.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="typeCatalog">The type catalog.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <Controller, IControllerActivator> Register <TControllerActivator>(this TypeMappingRegistry <Controller, IControllerActivator> instance, TypeCatalog typeCatalog) where TControllerActivator : IControllerActivator
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(typeCatalog, "typeCatalog");

            IList <Type> controllerTypes = typeCatalog.ToList();

            EnsureControllerTypes(controllerTypes);

            Type controllerActivatorType = typeof(TControllerActivator);

            foreach (Type controllerType in controllerTypes)
            {
                instance.Register(controllerType, controllerActivatorType);
            }

            return(instance);
        }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureModelBindersBase"/> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 protected ConfigureModelBindersBase(TypeMappingRegistry <object, IModelBinder> registry) : base(registry)
 {
 }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TModel1">The type of the model1.</typeparam>
        /// <typeparam name="TModel2">The type of the model2.</typeparam>
        /// <typeparam name="TModel3">The type of the model3.</typeparam>
        /// <typeparam name="TModel4">The type of the model4.</typeparam>
        /// <typeparam name="TModelBinder">The type of the model binder.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <object, IModelBinder> Register <TModel1, TModel2, TModel3, TModel4, TModelBinder>(this TypeMappingRegistry <object, IModelBinder> instance)
            where TModelBinder : IModelBinder
        {
            Invariant.IsNotNull(instance, "instance");

            Type modelBinderType = typeof(TModelBinder);

            instance.Register(typeof(TModel1), modelBinderType);
            instance.Register(typeof(TModel2), modelBinderType);
            instance.Register(typeof(TModel3), modelBinderType);
            instance.Register(typeof(TModel4), modelBinderType);

            return(instance);
        }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TModel">The type of the model.</typeparam>
        /// <typeparam name="TModelBinder">The type of the model binder.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <object, IModelBinder> Register <TModel, TModelBinder>(this TypeMappingRegistry <object, IModelBinder> instance)
            where TModelBinder : IModelBinder
        {
            Invariant.IsNotNull(instance, "instance");

            instance.Register(typeof(TModel), typeof(TModelBinder));

            return(instance);
        }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TModelBinder">The type of the action invoker.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="typeCatalog">The type catalog.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <object, IModelBinder> Register <TModelBinder>(this TypeMappingRegistry <object, IModelBinder> instance, TypeCatalog typeCatalog) where TModelBinder : IModelBinder
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(typeCatalog, "typeCatalog");

            Type modelBinderType = typeof(TModelBinder);

            foreach (Type modelType in typeCatalog.ToList())
            {
                instance.Register(modelType, modelBinderType);
            }

            return(instance);
        }
Esempio n. 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurableTypeMappingBase{TType1,TType2}"/> class.
        /// </summary>
        /// <param name="registry">The registry.</param>
        protected ConfigurableTypeMappingBase([NotNull] TypeMappingRegistry <TType1, TType2> registry)
        {
            Invariant.IsNotNull(registry, "registry");

            Registry = registry;
        }
Esempio n. 16
0
        public static TypeMappingRegistry <Controller, IActionInvoker> Register <TController, TActionInvoker>([NotNull] this TypeMappingRegistry <Controller, IActionInvoker> instance)
            where TController : Controller
            where TActionInvoker : IActionInvoker
        {
            Invariant.IsNotNull(instance, "instance");

            instance.Register(typeof(TController), typeof(TActionInvoker));

            return(instance);
        }
Esempio n. 17
0
        public static TypeMappingRegistry <Controller, IActionInvoker> Register <TController1, TController2, TController3, TActionInvoker>([NotNull] this TypeMappingRegistry <Controller, IActionInvoker> instance)
            where TController1 : Controller
            where TController2 : Controller
            where TController3 : Controller
            where TActionInvoker : IActionInvoker
        {
            Invariant.IsNotNull(instance, "instance");

            Type actionInvokerType = typeof(TActionInvoker);

            instance.Register(typeof(TController1), actionInvokerType);
            instance.Register(typeof(TController2), actionInvokerType);
            instance.Register(typeof(TController3), actionInvokerType);

            return(instance);
        }
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TController1">The type of the controller1.</typeparam>
        /// <typeparam name="TController2">The type of the controller2.</typeparam>
        /// <typeparam name="TController3">The type of the controller3.</typeparam>
        /// <typeparam name="TController4">The type of the controller4.</typeparam>
        /// <typeparam name="TControllerActivator">The type of the controller activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <Controller, IControllerActivator> Register <TController1, TController2, TController3, TController4, TControllerActivator>(this TypeMappingRegistry <Controller, IControllerActivator> instance)
            where TController1 : Controller
            where TController2 : Controller
            where TController3 : Controller
            where TController4 : Controller
            where TControllerActivator : IControllerActivator
        {
            Invariant.IsNotNull(instance, "instance");

            Type controllerActivatorType = typeof(TControllerActivator);

            instance.Register(typeof(TController1), controllerActivatorType);
            instance.Register(typeof(TController2), controllerActivatorType);
            instance.Register(typeof(TController3), controllerActivatorType);
            instance.Register(typeof(TController4), controllerActivatorType);

            return(instance);
        }
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureControllerActivatorsBase"/> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 protected ConfigureControllerActivatorsBase([NotNull] TypeMappingRegistry <Controller, IControllerActivator> registry) : base(registry)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigureActionInvokersBase"/> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 protected ConfigureActionInvokersBase(TypeMappingRegistry <Controller, IActionInvoker> registry) : base(registry)
 {
 }