public void TestFirstOrDefault() { // create QueryDesigner with ElementType == Products var queryDesinger = new QueryDesigner(context, typeof(Products)); //create root node which elementType has the same type in queryDesigner var root = new JoinNode(typeof(Products)); // create 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"); // add categoryNode to root node root.AddChildren(categoryNode); // create filter by Products.ProductName like "%l%" var productNameCondition = new Condition("ProductName", "l", ConditionOperator.Like); root.AddConditions(productNameCondition); // create filter by Categories.Description like "Sweet%" var categoryNameCondition = new Condition("Description", "Sweet", ConditionOperator.StartsWith, typeof(Categories)); categoryNode.AddConditions(categoryNameCondition); // make join Products table with Categories filtered by conditions // and ordered by already created ordering queryDesinger.Join(root); object first = queryDesinger.FirstOrDefault(); Assert.IsInstanceOfType(typeof(Products), first); }