Table of Contents

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

TModel

Model 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

isAscending bool

Whether the sorting is ascending (otherwise descending).

property Expression<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

isAscending bool

Whether the sorting is ascending (otherwise descending).

propertyPath string

Property path (property names separated by dots).

Properties

IsAscending

Whether the sorting is ascending (otherwise descending).

public bool IsAscending { get; }

Property Value

bool

PropertyPath

Property path to sort by (e.g. "Category.Name").

public string PropertyPath { get; }

Property Value

string

Methods

Parse(string)

Parses the sorting from a string.

public static Sorting<TModel> Parse(string value)

Parameters

value string

Property path to sort by, prefixed with "-" for descending order (e.g. "name" or "-created").

Returns

Sorting<TModel>

Sorting.