Example #1
0
        private bool TryCreateImplicitSorting(
            PropertyInfo property,
            out SortOperationDefintion definition)
        {
            Type type = property.PropertyType;

            if (type.IsGenericType &&
                System.Nullable.GetUnderlyingType(type) is Type nullableType)
            {
                type = nullableType;
            }
            if (typeof(IComparable).IsAssignableFrom(type))
            {
                definition = SortOperationDescriptor
                             .CreateOperation(property, Context)
                             .CreateDefinition();
                return(true);
            }
            if (type.IsClass && !DotNetTypeInfoFactory.IsListType(type))
            {
                definition = SortObjectOperationDescriptor
                             .CreateOperation(property, Context)
                             .CreateDefinition();
                return(true);
            }

            definition = null;
            return(false);
        }
Example #2
0
        private bool TryCreateImplicitSorting(
            PropertyInfo property,
            out SortOperationDefintion definition)
        {
            if (typeof(IComparable).IsAssignableFrom(property.PropertyType))
            {
                definition = SortOperationDescriptor
                             .CreateOperation(property, Context)
                             .CreateDefinition();
                return(true);
            }
            if (
                property.PropertyType.IsClass &&
                !typeof(IEnumerable <>).IsAssignableFrom(property.PropertyType))
            {
                definition = SortObjectOperationDescriptor
                             .CreateOperation(property, Context)
                             .CreateDefinition();
                return(true);
            }

            definition = null;
            return(false);
        }
Example #3
0
 public SortOperationField(SortOperationDefintion definition)
     : base(definition, default)
 {
     Operation = definition.Operation;
 }
Example #4
0
 static InputField CreateField(SortOperationDefintion fieldDef, int index)
 => new SortOperationField(fieldDef, index);
Example #5
0
 protected override void OnCreateDefinition(
     SortOperationDefintion definition)
 {
     if (Definition?.Operation?.Property is { })
Example #6
0
 public SortOperationField(SortOperationDefintion definition, int index)
     : base(definition, index)
 {
     Operation = definition.Operation;
 }