| | | 1 | | using Plainquire.Filter.Abstractions; |
| | | 2 | | using System.Reflection; |
| | | 3 | | |
| | | 4 | | namespace Plainquire.Sort; |
| | | 5 | | |
| | | 6 | | internal static class MemberInfoExtensions |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets the (MVC controller action) parameter name of the sort. |
| | | 10 | | /// </summary> |
| | | 11 | | /// <param name="member">The property to get the name for.</param> |
| | | 12 | | /// <param name="prefix">A prefix to use.</param> |
| | | 13 | | public static string GetSortParameterName(this MemberInfo member, string? prefix = null) |
| | | 14 | | { |
| | 282 | 15 | | var filterAttribute = member.GetCustomAttribute<FilterAttribute>(); |
| | 282 | 16 | | return $"{prefix ?? member.ReflectedType.ExpandTypeName()}{filterAttribute?.Name ?? member.Name}".LowercaseFirst |
| | | 17 | | } |
| | | 18 | | } |