Пример #1
0
 public ConditionVisitor(ParameterExpression message, ErrorListener errors, Route route, RouteCompilerFlags routeCompilerFlags)
 {
     this.message            = Preconditions.CheckNotNull(message);
     this.errors             = Preconditions.CheckNotNull(errors);
     this.route              = Preconditions.CheckNotNull(route);
     this.routeCompilerFlags = routeCompilerFlags;
 }
Пример #2
0
        public Func <IMessage, Bool> Compile(Route route, RouteCompilerFlags routeCompilerFlags)
        {
            var        errorListener = new ErrorListener();
            IParseTree tree          = GetParseTree(route, errorListener);

            errorListener.Validate();

            ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "message");
            var        visitor            = new ConditionVisitor(parameter, errorListener, route, routeCompilerFlags);
            Expression expression         = visitor.Visit(tree);

            errorListener.Validate();

            Func <IMessage, Bool> rule = Expression.Lambda <Func <IMessage, Bool> >(Expression.Convert(expression, typeof(Bool)), parameter).Compile();

            return(rule);
        }
Пример #3
0
 public override bool IsEnabled(RouteCompilerFlags routeCompilerFlags)
 {
     return(routeCompilerFlags.HasFlag(RouteCompilerFlags.BodyQuery));
 }
Пример #4
0
 public virtual bool IsEnabled(RouteCompilerFlags routeCompilerFlags)
 {
     return(true);
 }
Пример #5
0
 public override bool IsEnabled(RouteCompilerFlags routeCompilerFlags)
 {
     return(routeCompilerFlags.HasFlag(RouteCompilerFlags.TwinChangeIncludes));
 }
Пример #6
0
 public static bool IsFlagEnabled(this RouteCompilerFlags routeCompilerFlags, RouteCompilerFlags flagToCheck)
 {
     return((routeCompilerFlags & flagToCheck) != 0);
 }