Example #1
0
        private String GetEnumArgumentValues <TType>(IList <TType> values)
        {
            List <String> result = new List <String>();

            if (typeof(TType).IsEnum && values != null && values.Any())
            {
                foreach (TType value in values)
                {
                    MemberInfo member = typeof(TType)
                                        .GetMember(value.ToString())
                                        .FirstOrDefault();

                    if (member != null)
                    {
                        QueryArgumentValueAttribute attribute = member
                                                                .GetCustomAttributes(typeof(QueryArgumentValueAttribute), false)
                                                                .FirstOrDefault() as QueryArgumentValueAttribute;

                        if (attribute != null && !String.IsNullOrWhiteSpace(attribute.Name))
                        {
                            result.Add(attribute.Name);
                        }
                    }
                }
            }

            return(String.Join(this.Separator, result));
        }
Example #2
0
        private String GetClassArgumentLabel <TType>(PropertyInfo property)
        {
            QueryArgumentValueAttribute attribute = property
                                                    .GetCustomAttributes(typeof(QueryArgumentValueAttribute), false)
                                                    .FirstOrDefault() as QueryArgumentValueAttribute;

            return(attribute?.Name);
        }