public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            Context = parameterTransformContext;
            foreach (var parameter in parameters)
            {
                ResolveParameter(parameter);
            }

            return(parameters);
        }
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     Context = parameterTransformContext;
     var url = Context.MethodInfo.GetCustomAttribute<HttpAttribute>().URL;
     return
         Context.MethodInfo.GetParameters()
            .Select((x, i) => new { Index = i, ParameterInfo = x })
            .Where(x => Context.ApiInvocation.GetArgumentValue(x.Index) != null)
            .Select(x => new Parameter(x.ParameterInfo, Context.ApiInvocation.GetArgumentValue(x.Index), ResolveParameterType(x.ParameterInfo, url)))
            .ToList();
 }
Пример #3
0
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            Context = parameterTransformContext;
            var url = Context.MethodInfo.GetCustomAttribute <HttpAttribute>().URL;

            return
                (Context.MethodInfo.GetParameters()
                 .Select((x, i) => new { Index = i, ParameterInfo = x })
                 .Where(x => Context.ApiInvocation.GetArgumentValue(x.Index) != null)
                 .Select(x => new Parameter(x.ParameterInfo, Context.ApiInvocation.GetArgumentValue(x.Index), ResolveParameterType(x.ParameterInfo, url)))
                 .ToList());
        }
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     foreach (var parameter in parameters)
     {
         if (ParameterIsEnumerable(parameter) && parameter.ParameterType != ParameterType.Content)
         {
             foreach (var value in (IEnumerable)parameter.ParameterValue)
             {
                 yield return new Parameter(parameter, value);
             }
         }
         else
         {
             yield return parameter;
         }
     }
 }
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            var list    = parameters.ToList();
            var content = list.First(x => x.ParameterType == ParameterType.Content);

            list.Add(new Parameter(null, content.ParameterValue.GetType().Name.ToLower(), ParameterType.Route)
            {
                Name = "type"
            });
            return(list);
        }
 public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     foreach (var parameter in parameters)
     {
         if (ParameterIsEnumerable(parameter) && parameter.ParameterType != ParameterType.Content)
         {
             foreach (var value in (IEnumerable)parameter.ParameterValue)
             {
                 yield return(new Parameter(parameter, value));
             }
         }
         else
         {
             yield return(parameter);
         }
     }
 }
Пример #7
0
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            foreach (var parameter in parameters)
            {
                if (parameter.ParameterType == ParameterType.Content)
                {
                    ((Dictionary <string, object>)parameter.Value)["Name"] = "Mighty Gazelle";
                }
            }

            return(parameters);
        }
Пример #8
0
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     return new NoCacheListTransformer().TransformParameters(parameters, parameterTransformContext);
 }
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            var parameterList = parameters.ToList();

            parameterList.Add(new Parameter(null, Guid.NewGuid(), ParameterType.Query)
            {
                Name = "_"
            });
            return(parameterList);
        }
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     return parameterTransformContext.MethodInfo.GetAttributesChain<ParameterListTransformerAttribute>().Aggregate(parameters,
         (current, transformer) => transformer.TransformParameters(current, parameterTransformContext));
 }
Пример #11
0
 public abstract IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext);
 public abstract IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext);
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     parameters.ForEach(Resolve);
     return parameters;
 }
 public override IEnumerable<Parameter> TransformParameters(IEnumerable<Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     var parameterList = parameters.ToList();
     parameterList.Add(new Parameter(null, Guid.NewGuid(), ParameterType.Query) { Name = "_" });
     return parameterList;
 }
Пример #15
0
        public IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            var param = parameters.Single(x => x.ParameterType == ParameterType.Content);

            var widget = (WidgetData)param.ParameterValue;
            var value  = widget.WidgetKey;
            var list   = parameters.ToList();

            list.Add(new Parameter(null, value, ParameterType.Route)
            {
                Name = "widget-key", Value = value
            });

            param.Value = new { Data = widget.Data }.ToDictionary();
            return(list);
        }
Пример #16
0
 public IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     Resolve(parameters.Single(x => x.ParameterType == ParameterType.Content));
     return(parameters);
 }
Пример #17
0
 public IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     parameters.ForEach(Resolve);
     return(parameters);
 }
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            var list = parameters.ToList();

            if (parameterTransformContext.MethodInfo.DeclaringType.GetGenericArguments().Any())
            {
                var value = parameterTransformContext.MethodInfo.DeclaringType.GetGenericArguments().First().Name.ToLower();
                list.Add(new Parameter(null, value, ParameterType.Route)
                {
                    Name = "type"
                });
            }

            return(list);
        }
Пример #19
0
 public IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     return(parameterTransformContext.MethodInfo.GetAttributesChain <ParameterListTransformerAttribute>()
            .Aggregate(parameters, (current, transformer) =>
                       transformer.TransformParameters(current, parameterTransformContext)));
 }
Пример #20
0
        public IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            foreach (var parameter in parameters)
            {
                Apply(parameter);
            }

            return(parameters);
        }
Пример #21
0
        public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
        {
            var parameterList = parameters.ToList();

            parameterList.Add(new Parameter(null, _value, ParameterType.Query)
            {
                Name = _name, Value = _value
            });
            return(parameterList);
        }
Пример #22
0
 public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     return(parameters.Reverse());
 }
Пример #23
0
 public override IEnumerable <Parameter> TransformParameters(IEnumerable <Parameter> parameters, ParameterTransformContext parameterTransformContext)
 {
     return(new NoCacheListTransformer().TransformParameters(parameters, parameterTransformContext));
 }