private List <Product> GetProductsByCategoryFromBDC(string categoryId) { List <Product> products = new List <Product>(); IEntityInstance sourceCategory = CategoryEntity.FindSpecific(categoryId, ProductCatalogSystem); EntityInstanceCollection source = new EntityInstanceCollection(); if (source != null) { source.Add(sourceCategory); } IEntityInstanceEnumerator entitiesEnumerator = ProductEntity.FindAssociated(source, ProductCatalogSystem); while (entitiesEnumerator.MoveNext()) { IEntityInstance productInstance = entitiesEnumerator.Current; Product product = new Product(); product.CategoryId = (string)productInstance["CategoryId"]; product.ImagePath = (string)productInstance["ImagePath"]; product.LongDescription = (string)productInstance["LongDescription"]; product.ShortDescription = (string)productInstance["ShortDescription"]; product.Name = (string)productInstance["Name"]; product.Sku = (string)productInstance["Sku"]; product.ThumbnailImagePath = (string)productInstance["ThumbnailImagePath"]; products.Add(product); SetCachedProduct(product); } return(products); }