Ejemplo n.º 1
0
        public List <Category> GetCategories(bool includeHiddenCategories)
        {
            // This is correct, but there's a bug in ES that doesn't honor the DNN Object Qualifier for M2M collections :(
            //List<Category> categories = this.UpToCategoryCollection;
            //if (!includeHiddenCategories)
            //{
            //    categories.RemoveAll(c => !c.IsDisplayed.GetValueOrDefault());
            //}
            //return categories;

            //SELECT
            //c.*
            //FROM DNNspot_Store_Category c
            //INNER JOIN DNNspot_Store_ProductCategory pc ON pc.CategoryId = c.Id
            //WHERE pc.ProductId = 21

            CategoryQuery        c  = new CategoryQuery("c");
            ProductCategoryQuery pc = new ProductCategoryQuery("pc");

            c.Select(c).InnerJoin(pc).On(c.Id == pc.CategoryId);
            c.Where(pc.ProductId == this.Id.Value);

            CategoryCollection collection = new CategoryCollection();

            collection.Load(c);

            return(collection.ToList());
        }