Beispiel #1
0
        public ActionDescriptorValues([NotNull] ActionDescriptor inner)
        {
            Name               = inner.Name;
            DisplayName        = inner.DisplayName;
            Parameters         = inner.Parameters.Select(p => new ParameterDescriptorValues(p)).ToList();
            FilterDescriptors  = inner.FilterDescriptors.Select(f => new FilterDescriptorValues(f)).ToList();
            RouteConstraints   = inner.RouteConstraints.Select(r => new RouteDataActionConstraintValues(r)).ToList();
            AttributeRouteInfo = new AttributeRouteInfoValues(inner.AttributeRouteInfo);
            RouteValueDefaults = inner.RouteValueDefaults.ToDictionary(i => i.Key, i => i.Value.ToString());
            ActionConstraints  = inner.ActionConstraints?.Select(a => new ActionConstraintValues(a))?.ToList();
            HttpMethods        =
                inner.ActionConstraints?.OfType <HttpMethodConstraint>().SelectMany(c => c.HttpMethods).ToList();
            Properties = inner.Properties.ToDictionary(i => i.Key.ToString(), i => i.Value.GetType());
            var controllerActionDescriptor = inner as ControllerActionDescriptor;

            if (controllerActionDescriptor != null)
            {
                MethodInfo         = controllerActionDescriptor.MethodInfo;
                ControllerName     = controllerActionDescriptor.ControllerName;
                ControllerTypeInfo = controllerActionDescriptor.ControllerTypeInfo;
            }
        }
 public ActionDescriptorValues([NotNull] ActionDescriptor inner)
 {
     Name = inner.Name;
     DisplayName = inner.DisplayName;
     Parameters = inner.Parameters.Select(p => new ParameterDescriptorValues(p)).ToList();
     BoundProperties = inner.BoundProperties.Select(p => new ParameterDescriptorValues(p)).ToList();
     FilterDescriptors = inner.FilterDescriptors.Select(f => new FilterDescriptorValues(f)).ToList();
     RouteConstraints = inner.RouteConstraints.Select(r => new RouteDataActionConstraintValues(r)).ToList();
     AttributeRouteInfo = new AttributeRouteInfoValues(inner.AttributeRouteInfo);
     RouteValueDefaults = inner.RouteValueDefaults.ToDictionary(i => i.Key, i => i.Value.ToString());
     ActionConstraints = inner.ActionConstraints?.Select(a => new ActionConstraintValues(a))?.ToList();
     HttpMethods =
         inner.ActionConstraints?.OfType<HttpMethodConstraint>().SelectMany(c => c.HttpMethods).ToList();
     Properties = inner.Properties.ToDictionary(i => i.Key.ToString(), i => i.Value.GetType());
     var controllerActionDescriptor = inner as ControllerActionDescriptor;
     if (controllerActionDescriptor != null)
     {
         MethodInfo = controllerActionDescriptor.MethodInfo;
         ControllerName = controllerActionDescriptor.ControllerName;
         ControllerTypeInfo = controllerActionDescriptor.ControllerTypeInfo;
     }
 }