public IList <ProductLine> FindByName(string productLineName, bool includeProducts)
        {
            var results = m_DataSource.From <ProductLine>(new { productLineName }).ToCollection().Execute();

            if (results.Count > 0 && includeProducts)
            {
                var children = m_DataSource.GetByKeyList(ProductTable, "ProductLineKey",
                                                         results.Select(pl => pl.ProductLineKey)).ToCollection <Product>().Execute();
                foreach (var line in results)
                {
                    line.Products.AddRange(children.Where(x => x.ProductLineKey == line.ProductLineKey));
                }
            }
            return(results);
        }
Ejemplo n.º 2
0
 public void Example5_Chain()
 {
     //List support is only available for primary keys.
     var posts = s_DataSource.GetByKeyList("Posts", new[] { 1, 2, 3 }).ToCollection<Post>().Execute();
 }