public Category(long id, ICategoryInfo categoryInfo) { _id = id; _name = categoryInfo.Name; }
public IEnumerable<ICategory> CreateCategory(ICategoryInfo categoryInfo) { // NOTE : Requires a .ToList() here so that we force all to be created return CreateCategory(categoryInfo, null).ToList(); }
public ICategory CreateCategory(ICategoryInfo categoryInfo) { return new Category(GetNextIndex(), categoryInfo); }
private IEnumerable<ICategory> CreateCategory(ICategoryInfo categoryInfo, ICategory parentCategory) { var category = CategoryFactoryService.CreateCategory(categoryInfo); _idIndex.Add(category.Id, category); _nameIndex.Add(category.Name, category); _labelIndex.Put(category.Name, category.Id); if (parentCategory != null) { if (!_isAIndex.ContainsKey(category.Id)) _isAIndex.Add(category.Id, new List<long>()); _isAIndex[category.Id].Add(parentCategory.Id); if (!_isAIndexInverse.ContainsKey(parentCategory.Id)) _isAIndexInverse.Add(parentCategory.Id, new List<long>()); _isAIndexInverse[parentCategory.Id].Add(category.Id); } yield return category; foreach (var childCategoryInfo in categoryInfo.Children) { var childCategories = CreateCategory(childCategoryInfo, category); foreach (var childCategory in childCategories) yield return childCategory; } }
public CategoryInfo(ICategoryInfo data) : base(data, typeof(ICategoryInfo)) { }