Ejemplo n.º 1
0
 /// <summary>
 /// Gets the grouped searched properties by target property.
 /// </summary>
 /// <param name="baseFilterDto">The base filtering DTO</param>
 /// <returns>The grouped searched properties</returns>
 private static IEnumerable <IGrouping <string, PropertyInfo> > GetGroupedSearchedPropertiesInfo(BaseFilterDto baseFilterDto)
 {
     return(baseFilterDto.GetType().GetProperties()
            .Where(x => x.GetCustomAttributes(typeof(FilterAttribute), true).Length > 0)
            .GroupBy(x => ((FilterAttribute)x.GetCustomAttribute(typeof(FilterAttribute))).TargetProperty));
 }
Ejemplo n.º 2
0
 private static IEnumerable <IGrouping <string, PropertyInfo> > GetFilterProperties(BaseFilterDto baseFilterDto)
 {
     return(baseFilterDto.GetType().GetProperties()
            .Where(x => Attribute.IsDefined(x, typeof(FilterAttribute)))
            .GroupBy(x => x.GetCustomAttribute <FilterAttribute>().TargetProperty));
 }