internal static void Parse(out ConditionList conditions, out OrderingList orderings, params IParameterMarker[] queryDesignerParameters) { conditions = new ConditionList(); orderings = new OrderingList(); foreach (IParameterMarker parameter in queryDesignerParameters) { if (parameter != null) { if (parameter is ConditionList) { conditions.AddConditions(parameter as IEnumerable<BaseCondition>); } else if (parameter is OrderingList) { orderings.AddOrderings(parameter as OrderingList); } else { throw new NotSupportedException("parameter"); } } conditions.RemoveDuplicates(); orderings.RemoveDuplicates(); } }
public void Init() { _datafiles = EnumerateMatchingFiles(_spec).OrderBy(p => p.ToLower()).ToList(); _cacheFiles = (Program.Args.CacheDir == null) ? new HashSet <string>() : Directory.EnumerateFiles(Program.Args.CacheDir).Select(Path.GetFileName).ToHashSet(); _orderIndizes = _spec.GetOrdering(); _filesSubs = _datafiles.Where(p => p.EndsWith(".vtt")).ToList(); _filesInfo = _datafiles.Where(p => p.EndsWith(".info.json")).ToList(); _filesToml = _datafiles.Where(p => p.EndsWith(".info.tom")).ToList(); }
public void TestJoinWithOneChildSkipAndTake() { const int resultRowCount = 10; //create root node var root = new JoinNode(typeof(Products)); // add child node Categories with propertyName "Products". // Because Categories linked with Products by next property: // public EntitySet<Products> Products var categoryNode = new JoinNode(typeof(Categories), "Category", "Products"); root.AddChildren(categoryNode); var queryDesinger = new QueryDesigner(context, typeof(Products)); OrderingList parameteres = new OrderingList(new Ordering("ProductName", typeof(Products)), new Ordering("CategoryName", SortDirection.Descending, typeof(Categories))); queryDesinger.Join(root, parameteres); queryDesinger.Skip(10).Take(10); var list = new List<Products>(queryDesinger.Cast<Products>()); Assert.AreEqual(resultRowCount, list.Count); }