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); }
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); }
public SortOperationField(SortOperationDefintion definition) : base(definition, default) { Operation = definition.Operation; }
static InputField CreateField(SortOperationDefintion fieldDef, int index) => new SortOperationField(fieldDef, index);
protected override void OnCreateDefinition( SortOperationDefintion definition) { if (Definition?.Operation?.Property is { })
public SortOperationField(SortOperationDefintion definition, int index) : base(definition, index) { Operation = definition.Operation; }