コード例 #1
0
        private static string UnrollMemberPath(MemberExpression predicate, RequestBuilderConfiguration configuration)
        {
            var path = "";

            if (predicate.Expression != null && predicate.Expression is MemberExpression)
            {
                path = UnrollMemberPath(predicate.Expression as MemberExpression, configuration) + ".";
            }

            return(path + FieldInterpreter.Run(predicate.Member.Name, configuration));
        }
コード例 #2
0
        private static string GetFields(PropertyInfo property, RequestBuilderConfiguration configuration, string parentPath = "")
        {
            var fields = new List <string>();
            var path   = parentPath + FieldInterpreter.Run(property.Name, configuration);

            if (property.GetCustomAttribute <IncludeAttribute>() != null)
            {
                foreach (var p in property.PropertyType.GetProperties())
                {
                    fields.Add(GetFields(p, configuration, path + "."));
                }
            }
            else if (property.GetCustomAttribute <ExcludeAttribute>() == null)
            {
                fields.Add(path);
            }

            return(string.Join(",", fields));
        }