public object ResolvePropertyCustom(object key, PropertyInfo propertyInfo, object context) { var first = RuleMaps.First(); return(RuleMaps.Skip(1).Aggregate(first.ResolvePropertyCustom(key, propertyInfo, context), (result, ruleMap) => { var expression = ruleMap.ResolvePropertyCustom(key, propertyInfo, context); if (result == null && expression == null) { return null; } if (result == null) { return expression; } if (expression == null) { return result; } return GetInstanceCustomReducer(key)(result, expression); })); }
public Expression ResolveInstancePropertyCustomResolverExpression(PropertyInfo propertyInfo, object key, object context, Expression instanceExpression) { var first = RuleMaps.First(); return(RuleMaps.Skip(1).Aggregate(first.ResolveInstancePropertyCustomResolverExpression(propertyInfo, key, context, instanceExpression), (result, ruleMap) => { var expression = ruleMap.ResolveInstancePropertyCustomResolverExpression(propertyInfo, key, context, instanceExpression); if (result == null && expression == null) { return null; } if (result == null) { return expression; } if (expression == null) { return result; } return ruleMap.GetInstanceCustomExpressionReducer(key)(result, expression); })); }
public Expression GetInstanceCustomResolverExpression(object context, Expression instanceExpression, object key) { var first = RuleMaps.First(); var composedExpression = RuleMaps.Skip(1).Aggregate(first.GetInstanceCustomResolverExpression(context, instanceExpression, key), (result, ruleMap) => { var expression = ruleMap.GetInstanceCustomResolverExpression(context, instanceExpression, key); if (result == null && expression == null) { return(null); } if (result == null) { return(expression); } if (expression == null) { return(result); } return(ruleMap.GetInstanceCustomExpressionReducer(key)(result, expression)); }); return(composedExpression); }
public Expression GetInstancePermissionResolverExpression(object context, Expression instanceExpression) { var first = RuleMaps.First(); var composedExpression = RuleMaps.Skip(1).Aggregate(first.GetInstancePermissionResolverExpression(context, instanceExpression), (result, ruleMap) => { var expression = ruleMap.GetInstancePermissionResolverExpression(context, instanceExpression); if (result == null && expression == null) { return(null); } if (result == null) { return(expression); } if (expression == null) { return(result); } return(Expression.Or(Expression.Convert(result, typeof(int)), Expression.Convert(expression, typeof(int)))); }); return(composedExpression); }
public object ResolveTypeCustom(object key, object context) { var first = RuleMaps.First(); var composedExpression = RuleMaps.Skip(1).Aggregate(first.ResolveTypeCustom(key, context), (result, ruleMap) => { var expression = ruleMap.ResolveTypeCustom(key, context); if (result == null && expression == null) { return(null); } if (result == null) { return(expression); } if (expression == null) { return(result); } return(GetInstanceCustomReducer(key)(result, expression)); }); return(composedExpression); }
public Expression GetDefaultProjectionExpression(object context, Expression argumentExpression, IEnumerable <IRuleMap> ruleMaps) { var result = RuleMaps.First().GetDefaultProjectionExpression(context, argumentExpression, ruleMaps); return(result); }