コード例 #1
0
ファイル: ModelExtensions.cs プロジェクト: xwagner2/eXpand
        private static ExpressionEvaluator GetExpressionEvaluator(IModelNode dataSourceNode, CriteriaOperator criteriaOperator)
        {
            var typeInfo                   = dataSourceNode.GetGenericListArgument();
            var descendants                = ReflectionHelper.FindTypeDescendants(typeInfo);
            var propertyDescriptors        = descendants.SelectMany(info => info.Members).DistinctBy(info => info.Name).Select(info => new XafPropertyDescriptor(info, info.Name)).Cast <PropertyDescriptor>().ToArray();
            var evaluatorContextDescriptor = new EvaluatorContextDescriptorDefault(new PropertyDescriptorCollection(propertyDescriptors));

            return(new ExpressionEvaluator(evaluatorContextDescriptor, criteriaOperator, false, XpandModuleBase.Dictiorary.CustomFunctionOperators));
        }