Esempio n. 1
0
            protected override void GetResultsCore(List <Dictionary <string, object> > results,
                                                   object o)
            {
                object value = _property.Invoke(o, null);

                if (value != null)
                {
                    List <Dictionary <string, object> > oneResultPerRow =
                        new List <Dictionary <string, object> >();
                    foreach (Object item in (IEnumerable)value)
                    {
                        List <Dictionary <string, object> > subresults =
                            new List <Dictionary <string, object> >();
                        if (WhereFilterDoesNotApply(item))
                        {
                            PermuteResultsAtThisLevel(subresults, item);
                            GetNestedQueryResults(subresults, item);
                            oneResultPerRow.AddRange(subresults);
                        }
                    }
                    if (oneResultPerRow.Count == 0 && _requireAtLeastOneResult)
                    {
                        PermuteEmptyResult(results);
                    }
                    else
                    {
                        Permuter.Permute(results, oneResultPerRow);
                    }
                }
            }
Esempio n. 2
0
        private bool PermuteResultsAtThisLevel(List <Dictionary <string, object> > results, object o)
        {
            Debug.Assert(o != null);
            // see if we have any results that we should return as a result
            bool haveAtLeastOneResult = false;

            if (_showFieldProperties != null)
            {
                foreach (KeyValuePair <string, FieldProperties> pair in _showFieldProperties)
                {
                    haveAtLeastOneResult = true;
                    MethodInfo getProperty   = pair.Value.Method;
                    object     propertyValue = getProperty.Invoke(o, null);
                    if (pair.Value.IsEnumerable)
                    {
                        IEnumerable enumerableResult = propertyValue as IEnumerable;
                        Permuter.Permute(results, pair.Key, enumerableResult);
                    }
                    else
                    {
                        Permuter.Permute(results, pair.Key, propertyValue);
                    }
                }
            }
            return(haveAtLeastOneResult);
        }
Esempio n. 3
0
 private void PermuteEmptyResult(List <Dictionary <string, object> > results)
 {
     if (_showFieldProperties != null && _showFieldProperties.Count > 0)
     {
         foreach (KeyValuePair <string, FieldProperties> pair in _showFieldProperties)
         {
             Permuter.Permute(results, pair.Key, (object)null);
         }
     }
     else
     {
         Permuter.Permute(results, "", (object)null);
     }
 }