コード例 #1
0
        public static ControllerInfo Create(Type controllerType, RegisterSettings registerSettings, CodeRoutingProvider provider)
        {
            ControllerDescriptor controllerDescr = null;

             if (createActionInvoker != null) {

            Controller instance = null;

            try {
               instance = (Controller)FormatterServices.GetUninitializedObject(controllerType);

            } catch (SecurityException) { }

            if (instance != null) {

               ControllerActionInvoker actionInvoker = createActionInvoker(instance) as ControllerActionInvoker;

               if (actionInvoker != null) {
                  controllerDescr = getControllerDescriptor(actionInvoker, new ControllerContext { Controller = instance });
               }
            }
             }

             if (controllerDescr != null) {
            return new DescribedMvcControllerInfo(controllerDescr, controllerType, registerSettings, provider);
             }

             return new ReflectedMvcControllerInfo(controllerType, registerSettings, provider);
        }
コード例 #2
0
      public static ControllerInfo Create(Type controllerType, RegisterSettings registerSettings, CodeRoutingProvider provider) {

         HttpConfiguration configuration = registerSettings.Settings.HttpConfiguration();

         if (configuration == null) {

            throw new ArgumentException(
               "You must first specify an {0} instance using the HttpConfiguration key on {1}.Properties.".FormatInvariant(
                  typeof(HttpConfiguration).FullName,
                  typeof(CodeRoutingSettings).FullName
               )
            );
         }
         
         return new DescribedHttpControllerInfo(
            new HttpControllerDescriptor(
               configuration,
               controllerType.Name.Substring(0, controllerType.Name.Length - "Controller".Length),
               controllerType),
            controllerType,
            registerSettings,
            provider
         );
      }
コード例 #3
0
 public DescribedMvcControllerInfo(ControllerDescriptor controllerDescr, Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
     : base(type, registerSettings, provider)
 {
     this.controllerDescr = controllerDescr;
 }
コード例 #4
0
 protected ControllerInfo(Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
 {
     this.Type = type;
      this.Register = registerSettings;
      this.Provider = provider;
 }
コード例 #5
0
 public MvcControllerInfo(Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
     : base(type, registerSettings, provider)
 {
 }
コード例 #6
0
        public static ControllerInfo Create(Type controllerType, RegisterSettings registerSettings, CodeRoutingProvider provider)
        {
            ControllerDescriptor controllerDescr = null;

            if (createActionInvoker != null)
            {
                Controller instance = null;

                try {
                    instance = (Controller)FormatterServices.GetUninitializedObject(controllerType);
                } catch (SecurityException) { }

                if (instance != null)
                {
                    ControllerActionInvoker actionInvoker = createActionInvoker(instance) as ControllerActionInvoker;

                    if (actionInvoker != null)
                    {
                        controllerDescr = getControllerDescriptor(actionInvoker, new ControllerContext {
                            Controller = instance
                        });
                    }
                }
            }

            if (controllerDescr != null)
            {
                return(new DescribedMvcControllerInfo(controllerDescr, controllerType, registerSettings, provider));
            }

            return(new ReflectedMvcControllerInfo(controllerType, registerSettings, provider));
        }
コード例 #7
0
 public MvcControllerInfo(Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
     : base(type, registerSettings, provider)
 {
 }
コード例 #8
0
        public static ControllerInfo Create(Type controllerType, RegisterSettings registerSettings, CodeRoutingProvider provider)
        {
            HttpConfiguration configuration = registerSettings.Settings.HttpConfiguration();

            if (configuration == null)
            {
                throw new ArgumentException(
                          "You must first specify an {0} instance using the HttpConfiguration key on {1}.Properties.".FormatInvariant(
                              typeof(HttpConfiguration).FullName,
                              typeof(CodeRoutingSettings).FullName
                              )
                          );
            }

            return(new DescribedHttpControllerInfo(
                       new HttpControllerDescriptor(
                           configuration,
                           controllerType.Name.Substring(0, controllerType.Name.Length - "Controller".Length),
                           controllerType),
                       controllerType,
                       registerSettings,
                       provider
                       ));
        }
コード例 #9
0
 public DescribedHttpControllerInfo(HttpControllerDescriptor controllerDescr, Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
     : base(type, registerSettings, provider)
 {
     this.controllerDescr = controllerDescr;
 }
コード例 #10
0
 protected ControllerInfo(Type type, RegisterSettings registerSettings, CodeRoutingProvider provider)
 {
     this.Type     = type;
     this.Register = registerSettings;
     this.Provider = provider;
 }