Ejemplo n.º 1
0
        public XElement ToXml()
        {
            var operatorNode =
                new XElement(QueryFilter?.ToString() ?? string.Empty,
                             // attributes
                             FilterAttributes.Select(a => new XAttribute(a.Key, a.Value ?? string.Empty)),
                             // chieldNodes
                             new XElement("FieldRef",
                             // attributes
                                          new XAttribute("Name", FieldInternalName),
                                          FieldRefAttributes.Select(a => new XAttribute(a.Key, a.Value ?? string.Empty))
                                          )
                             );

            if (FieldValue != null)
            {
                var valueNode = new XElement("Value",
                                             new XAttribute("Type", FieldType),
                                             FieldValue
                                             );
                operatorNode.Add(valueNode);
            }

            return(operatorNode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new object.
        /// </summary>
        /// <param name="controllerType"></param>
        /// <param name="method"></param>
        /// <param name="routeAttribute"></param>
        public Route(ControllerType controllerType, MethodInfo method, RouteAttribute routeAttribute) : this()
        {
            ControllerType = controllerType;
            Method         = method;
            RouteAttribute = routeAttribute;

            FilterAttributes           = BuildFilterAttributes(controllerType, method);
            AuthorizationFilters       = FilterAttributes.OfType <IAuthorizationFilter>().ToArray();
            OtherFilters               = BuildOtherFilters(FilterAttributes, AuthorizationFilters);
            HasAllowAnonymousAttribute = method.GetCustomAttributes <AllowAnonymousAttribute>(inherit: false).Any();
            TypeParserResolver         = BuildTypeParserResolver(controllerType, method);
            TypeFormatterResolver      = BuildTypeFormatterResolver(controllerType, method);
            MethodParameters           = ExtractMethodParameters(method, TypeParserResolver);
            HttpMethod = ExtractHttpMethod(method);
            PathParts  = ExtractPathParts(MethodParameters, routeAttribute);

            ValidatePathParts();

            ID = Interlocked.Increment(ref _NextID);
        }
Ejemplo n.º 3
0
        public XElement ToXml()
        {
            var operatorNode =
                new XElement(QueryFilter?.ToString() ?? string.Empty,
                             // attributes
                             FilterAttributes.Select(a => new XAttribute(a.Key, a.Value ?? string.Empty)),
                             // chieldNodes
                             new XElement("FieldRef",
                             // attributes
                                          new XAttribute("Name", FieldInternalName),
                                          FieldRefAttributes.Select(a => new XAttribute(a.Key, a.Value ?? string.Empty))
                                          ),
                             new XElement("Values",
                                          FieldValues
                                          .Where(value => !string.IsNullOrEmpty(value))
                                          .Select(value => new XElement("Value",
                                                                        new XAttribute("Type", FieldType),
                                                                        value
                                                                        ))
                                          )
                             );

            return(operatorNode);
        }