Exemplo n.º 1
0
 protected virtual Func <IEnumerable <Claim> > BuildSelector(BinaryExpression[] expressions)
 {
     return(() =>
     {
         var properties = new List <ClaimProperty>();
         foreach (var expression in expressions)
         {
             var result = this.Visit(expression);
             if (result is ClaimProperty)
             {
                 properties.Add(result as ClaimProperty);
             }
             else if (result is IEnumerable)
             {
                 properties.AddRange((result as IEnumerable).OfType <ClaimProperty>());
             }
             else
             {
                 throw new NotImplementedException();
             }
         }
         return ClaimProperty.Productize(properties)
         .Select(group => this.Context.ClaimFactory.Create(group))
         .Where(claim => claim != null);
     });
 }
        private static object EvaluateAssign(ExpressionVisitor visitor, object left, object right)
        {
            var property = new ClaimProperty(
                Convert.ToString(left),
                right
                );

            return(property);
        }