| | 1 | | using System.Linq.Expressions; |
| | 2 | |
|
| | 3 | | namespace Fluorite.Strainer.Models.Filtering.Operators; |
| | 4 | |
|
| | 5 | | /// <summary> |
| | 6 | | /// Represents default information context for filter expression. |
| | 7 | | /// </summary> |
| | 8 | | public class FilterExpressionContext : IFilterExpressionContext |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Initializes a new instance of the <see cref="FilterExpressionContext"/> |
| | 12 | | /// class. |
| | 13 | | /// </summary> |
| | 14 | | /// <param name="filterValue"> |
| | 15 | | /// The filter value expression. |
| | 16 | | /// </param> |
| | 17 | | /// <param name="propertyValue"> |
| | 18 | | /// The property access expression. |
| | 19 | | /// </param> |
| | 20 | | /// <param name="isCaseInsensitiveForValues"> |
| | 21 | | /// Gets a value indicating whether Strainer should operate in case insensitive mode |
| | 22 | | /// when comparing values. |
| | 23 | | /// </param> |
| | 24 | | /// <param name="isMaterializedQueryable"> |
| | 25 | | /// A value indicating whether associated <see cref="IQueryable"/> |
| | 26 | | /// is in fact a already materialized collection. |
| | 27 | | /// </param> |
| | 28 | | /// <param name="isStringBasedProperty"> |
| | 29 | | /// Gets a value indicating whether targeted property is string based. |
| | 30 | | /// </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> |
| | 32 | | /// <paramref name="filterValue"/> is <see langword="null"/>. |
| | 33 | | /// </exception> |
| | 34 | | /// <exception cref="ArgumentNullException"> |
| | 35 | | /// <paramref name="propertyValue"/> is <see langword="null"/>. |
| | 36 | | /// </exception> |
| 322 | 37 | | public FilterExpressionContext( |
| 322 | 38 | | Expression filterValue, |
| 322 | 39 | | Expression propertyValue, |
| 322 | 40 | | bool isCaseInsensitiveForValues, |
| 322 | 41 | | bool isMaterializedQueryable, |
| 322 | 42 | | bool isStringBasedProperty) |
| | 43 | | { |
| 322 | 44 | | FilterValue = Guard.Against.Null(filterValue); |
| 322 | 45 | | PropertyValue = Guard.Against.Null(propertyValue); |
| 322 | 46 | | IsCaseInsensitiveForValues = isCaseInsensitiveForValues; |
| 322 | 47 | | IsMaterializedQueryable = isMaterializedQueryable; |
| 322 | 48 | | IsStringBasedProperty = isStringBasedProperty; |
| 322 | 49 | | } |
| | 50 | |
|
| | 51 | | /// <inheritdoc/> |
| 321 | 52 | | public Expression FilterValue { get; } |
| | 53 | |
|
| | 54 | | /// <inheritdoc/> |
| 74 | 55 | | public bool IsCaseInsensitiveForValues { get; } |
| | 56 | |
|
| | 57 | | /// <inheritdoc/> |
| 296 | 58 | | public bool IsMaterializedQueryable { get; } |
| | 59 | |
|
| | 60 | | /// <inheritdoc/> |
| 20 | 61 | | public bool IsStringBasedProperty { get; } |
| | 62 | |
|
| | 63 | | /// <inheritdoc/> |
| 321 | 64 | | public Expression PropertyValue { get; } |
| | 65 | | } |