コード例 #1
0
        private bool TryCreateImplicitSorting(
            PropertyInfo property,
            out SortFieldDefinition definition)
        {
            if (typeof(IComparable).IsAssignableFrom(property.PropertyType))
            {
                var field = new SortFieldDescriptor(Context, property);
                definition = field.CreateDefinition();
                return(true);
            }

            definition = null;
            return(false);
        }
コード例 #2
0
        public ISortFieldDescriptor Sortable(
            Expression <Func <T, IComparable> > property)
        {
            if (property.ExtractMember() is PropertyInfo p)
            {
                var field = new SortFieldDescriptor(Context, p);
                Fields.Add(field);
                return(field);
            }

            // TODO : resources
            throw new ArgumentException(
                      "Only properties are allowed for input types.",
                      nameof(property));
        }