Esempio n. 1
0
        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);
            }));
        }
Esempio n. 2
0
        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);
            }));
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }