Пример #1
0
 public OperatorReferencesBuilder(PredicateRouteOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     _options = options;
 }
Пример #2
0
        private static TOperator SelectOperator <TOperator>(IList <TOperator> allOperators, PredicateRouteOptions options, string name)
            where TOperator : Operator
        {
            var availableOperators = allOperators.Except(allOperators.Where(o => !string.IsNullOrEmpty(o.Key) &&
                                                                            !options.AdditionalOperators.Contains(o.Key)));

            if (!options.IncludeDefaultOperators)
            {
                availableOperators = availableOperators.Except(allOperators.Where(o => string.IsNullOrEmpty(o.Key)));
            }
            else
            {
                availableOperators = availableOperators.Except(allOperators.Where(o => string.IsNullOrEmpty(o.Key) &&
                                                                                  options.ExcludeDefaultOperators.Contains(o.Name)));
            }

            return(availableOperators.FirstOrDefault(o => string.Equals(o.Name, name, StringComparison.InvariantCultureIgnoreCase)));
        }
Пример #3
0
 private static PredicateOperator GetOperator(IPredicateSchemeProvider scheme, Type sourceType, PredicateRouteOptions options, string name)
 {
     return(SelectOperator(scheme.Operators.GetPredicatesForType(sourceType).ToList(), options, name));
 }