/// <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="TModelBinder">The type of the model binder.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <object, IModelBinder> Register <TModel1, TModel2, 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);

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

            Type actionInvokerType = typeof(TActionInvoker);

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

            return(instance);
        }
Esempio n. 3
0
        /// <summary>
        /// Registers the specified instance.
        /// </summary>
        /// <typeparam name="TView1">The type of the view1.</typeparam>
        /// <typeparam name="TView2">The type of the view2.</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 <TView1, TView2, TViewPageActivator>(this TypeMappingRegistry <IView, IViewPageActivator> instance)
            where TView1 : IView
            where TView2 : IView
            where TViewPageActivator : IViewPageActivator
        {
            Invariant.IsNotNull(instance, "instance");

            Type viewPageActivatorType = typeof(TViewPageActivator);

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

            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="TControllerActivator">The type of the controller activator.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static TypeMappingRegistry <Controller, IControllerActivator> Register <TController1, TController2, TControllerActivator>(this TypeMappingRegistry <Controller, IControllerActivator> instance)
            where TController1 : Controller
            where TController2 : Controller
            where TControllerActivator : IControllerActivator
        {
            Invariant.IsNotNull(instance, "instance");

            Type controllerActivatorType = typeof(TControllerActivator);

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

            return(instance);
        }
        public static TypeMappingRegistry <object, IModelBinder> Register <TModel, TModelBinder>([NotNull] this TypeMappingRegistry <object, IModelBinder> instance)
            where TModelBinder : IModelBinder
        {
            Invariant.IsNotNull(instance, "instance");

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

            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);
        }
        /// <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="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. 9
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. 10
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>
        /// 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);
        }