private static Expression Evaluate(this SCIMPresentExpression presentExpression, ParameterExpression parameterExpression) { if (parameterExpression.Type == typeof(SCIMRepresentation)) { var resourceAttrParameterExpr = Expression.Parameter(typeof(SCIMRepresentationAttribute), "ra"); var anyLambdaExpression = presentExpression.Content.Evaluate(resourceAttrParameterExpr, (param) => BuildPresent(param)); var attributesProperty = Expression.Property(parameterExpression, "Attributes"); var anyLambda = Expression.Lambda <Func <SCIMRepresentationAttribute, bool> >(anyLambdaExpression, resourceAttrParameterExpr); return(Expression.Call(typeof(Enumerable), "Any", new[] { typeof(SCIMRepresentationAttribute) }, attributesProperty, anyLambda)); } return(presentExpression.Content.Evaluate(parameterExpression, (param) => BuildPresent(param))); }
private static Expression Evaluate(this SCIMPresentExpression presentExpression, ParameterExpression parameterExpression) { if (parameterExpression.Type == typeof(SCIMRepresentationModel)) { var commonAttribute = GetCommonAttribute(presentExpression.Content, parameterExpression); if (commonAttribute != null) { return(Expression.Equal(Expression.Constant(true), Expression.Constant(true))); } var resourceAttrParameterExpr = Expression.Parameter(typeof(SCIMRepresentationAttributeModel), "ra"); var anyLambdaExpression = presentExpression.Content.Evaluate(resourceAttrParameterExpr, (param) => BuildPresent(param)); var attributesProperty = Expression.Property(parameterExpression, "Attributes"); var anyLambda = Expression.Lambda <Func <SCIMRepresentationAttributeModel, bool> >(anyLambdaExpression, resourceAttrParameterExpr); return(Expression.Call(typeof(Enumerable), "Any", new[] { typeof(SCIMRepresentationAttributeModel) }, attributesProperty, anyLambda)); } return(presentExpression.Content.Evaluate(parameterExpression, (param) => BuildPresent(param))); }