示例#1
0
文件: Query.cs 项目: sillsdev/wesay
            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);
                    }
                }
            }
示例#2
0
文件: Query.cs 项目: sillsdev/wesay
        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);
        }
示例#3
0
文件: Query.cs 项目: sillsdev/wesay
 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);
     }
 }