Class Sorting<TModel>
- Namespace
- Magicalizer.Domain
- Assembly
- Magicalizer.dll
Sorting of a model query by a property.
public class Sorting<TModel> : ISorting<TModel> where TModel : class, IModel
Type Parameters
TModelModel type.
- Inheritance
-
Sorting<TModel>
- Implements
-
ISorting<TModel>
- Inherited Members
Constructors
Sorting(bool, Expression<Func<TModel, object?>>)
Creates a sorting from the expression.
public Sorting(bool isAscending, Expression<Func<TModel, object?>> property)
Parameters
isAscendingboolWhether the sorting is ascending (otherwise descending).
propertyExpression<Func<TModel, object>>Expression of the property path.
Sorting(bool, string)
Creates a sorting from the property path.
public Sorting(bool isAscending, string propertyPath)
Parameters
isAscendingboolWhether the sorting is ascending (otherwise descending).
propertyPathstringProperty path (property names separated by dots).
Properties
IsAscending
Whether the sorting is ascending (otherwise descending).
public bool IsAscending { get; }
Property Value
PropertyPath
Property path to sort by (e.g. "Category.Name").
public string PropertyPath { get; }
Property Value
Methods
Parse(string)
Parses the sorting from a string.
public static Sorting<TModel> Parse(string value)
Parameters
valuestringProperty path to sort by, prefixed with "-" for descending order (e.g. "name" or "-created").
Returns
- Sorting<TModel>
Sorting.