Esempio n. 1
0
 public void OnProvidersExecuting(ActionConstraintProviderContext context)
 {
     foreach (var item in context.Results)
     {
         var marker = item.Metadata as BooleanConstraintMarker;
         if (marker != null)
         {
             Assert.Null(item.Constraint);
             item.Constraint = new BooleanConstraint()
             {
                 Pass = marker.Pass
             };
         }
     }
 }
Esempio n. 2
0
        private IReadOnlyList <IActionConstraint> GetConstraints(ActionDescriptor action)
        {
            if (action.ActionConstraints == null || action.ActionConstraints.Count == 0)
            {
                return(null);
            }

            var items   = action.ActionConstraints.Select(c => new ActionConstraintItem(c)).ToList();
            var context = new ActionConstraintProviderContext(action, items);

            _actionConstraintProvider.Invoke(context);

            return
                (context.Results
                 .Where(item => item.Constraint != null)
                 .Select(item => item.Constraint)
                 .ToList());
        }
Esempio n. 3
0
 public void OnProvidersExecuted(ActionConstraintProviderContext context)
 {
 }