Пример #1
0
 public static QueryOptions <T> CreateOptions <T>(this QueryValues queryValues)
     where T : class, new()
 => new QueryOptions <T>()
 .ConfigureCondition(queryValues)
 .ConfigurePaging(queryValues.Paging);
Пример #2
0
 public static QueryOptions <T> ConfigureCondition <T>(this QueryOptions <T> options, QueryValues values)
     where T : class, new()
 {
     options.ConditionExpression = Operator.Lambda <T, bool>(values.Keys.Join(
                                                                 typeof(T).GetProperties(),
                                                                 key => key,
                                                                 prop => prop.Name,
                                                                 (key, prop) => GenerateCondition(prop.Name, values[key]))
                                                             .Aggregate(Operator.And));
     return(options);
 }