| | 1 | | using Fluorite.Strainer.Models.Sorting; |
| | 2 | | using System.Reflection; |
| | 3 | |
|
| | 4 | | namespace Fluorite.Strainer.Models.Metadata; |
| | 5 | |
|
| | 6 | | /// <summary> |
| | 7 | | /// Represents filtering and sorting metadata for a class or struct, |
| | 8 | | /// setting default values for all its properties. |
| | 9 | | /// </summary> |
| | 10 | | public class ObjectMetadata : IObjectMetadata |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Initializes a new instance of the <see cref="ObjectMetadata"/> class. |
| | 14 | | /// </summary> |
| 19 | 15 | | public ObjectMetadata( |
| 19 | 16 | | string defaultSortingPropertyName, |
| 19 | 17 | | PropertyInfo defaultSortingPropertyInfo, |
| 19 | 18 | | SortingWay? defaultSortingWay) |
| | 19 | | { |
| 19 | 20 | | DefaultSortingPropertyName = Guard.Against.NullOrWhiteSpace(defaultSortingPropertyName); |
| 19 | 21 | | DefaultSortingPropertyInfo = Guard.Against.Null(defaultSortingPropertyInfo); |
| 19 | 22 | | DefaultSortingWay = defaultSortingWay; |
| 19 | 23 | | } |
| | 24 | |
|
| | 25 | | /// <inheritdoc/> |
| 13 | 26 | | public string DefaultSortingPropertyName { get; } |
| | 27 | |
|
| | 28 | | /// <inheritdoc/> |
| 11 | 29 | | public SortingWay? DefaultSortingWay { get; } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Gets or sets a value indicating whether related |
| | 33 | | /// object is marked as filterable. |
| | 34 | | /// </summary> |
| 30 | 35 | | public bool IsFilterable { get; set; } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// Gets or sets a value indicating whether related |
| | 39 | | /// object is marked as filterable. |
| | 40 | | /// </summary> |
| 30 | 41 | | public bool IsSortable { get; set; } |
| | 42 | |
|
| | 43 | | /// <inheritdoc/> |
| 17 | 44 | | public PropertyInfo DefaultSortingPropertyInfo { get; } |
| | 45 | | } |