コード例 #1
0
 private static bool ApplyFilter(Attribute attribute, FilterNode filter)
 {
     if (filter == null)
     {
         return(true);
     }
     return(filter.Eval(attribute));
 }
コード例 #2
0
        public Task <IBinding> TryCreateAsync(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            Type parametertype = context.Parameter.ParameterType;

            var attr = context.Parameter.GetCustomAttribute <TAttribute>();

            var cloner           = new AttributeCloner <TAttribute>(attr, context.BindingDataContract, _nameResolver);
            var attrNameResolved = cloner.GetNameResolvedAttribute();

            // This may do validation and throw too.
            bool canBind = _description.Eval(attrNameResolved);

            if (!canBind)
            {
                return(Task.FromResult <IBinding>(null));
            }
            return(_inner.TryCreateAsync(context));
        }