Ok it's working now. There is some better way to implement all functionality of ICategoryService than copy full CategoryService?:
public interface IMRMegaMenuStandardService : ICategoryService
{
/// <summary>
/// Logs the specified record.
/// </summary>
/// <param name="record">The record.</param>
}
public partial class MRMegaMenuStandardService : IMRMegaMenuStandardService
{
#region Fields
private readonly CatalogSettings _catalogSettings;
private readonly CommonSettings _commonSettings;
private readonly IAclService _aclService;
private readonly ICacheManager _cacheManager;
private readonly IDataProvider _dataProvider;
private readonly IDbContext _dbContext;
private readonly IEventPublisher _eventPublisher;
private readonly ILocalizationService _localizationService;
private readonly IRepository<AclRecord> _aclRepository;
private readonly IRepository<Category> _categoryRepository;
private readonly IRepository<Product> _productRepository;
private readonly IRepository<ProductCategory> _productCategoryRepository;
private readonly IRepository<StoreMapping> _storeMappingRepository;
private readonly IStaticCacheManager _staticCacheManager;
private readonly IStoreContext _storeContext;
private readonly IStoreMappingService _storeMappingService;
private readonly IWorkContext _workContext;
#endregion
#region Ctor
public MRMegaMenuStandardService(CatalogSettings catalogSettings,
CommonSettings commonSettings,
IAclService aclService,
ICacheManager cacheManager,
IDataProvider dataProvider,
IDbContext dbContext,
IEventPublisher eventPublisher,
ILocalizationService localizationService,
IRepository<AclRecord> aclRepository,
IRepository<Category> categoryRepository,
IRepository<Product> productRepository,
IRepository<ProductCategory> productCategoryRepository,
IRepository<StoreMapping> storeMappingRepository,
IStaticCacheManager staticCacheManager,
IStoreContext storeContext,
IStoreMappingService storeMappingService,
IWorkContext workContext)
{
_catalogSettings = catalogSettings;
_commonSettings = commonSettings;
_aclService = aclService;
_cacheManager = cacheManager;
_dataProvider = dataProvider;
_dbContext = dbContext;
_eventPublisher = eventPublisher;
_localizationService = localizationService;
_aclRepository = aclRepository;
_categoryRepository = categoryRepository;
_productRepository = productRepository;
_productCategoryRepository = productCategoryRepository;
_storeMappingRepository = storeMappingRepository;
_staticCacheManager = staticCacheManager;
_storeContext = storeContext;
_storeMappingService = storeMappingService;
_workContext = workContext;
}
#endregion
#region Methods
/// <summary>
/// Delete category
/// </summary>
/// <param name="category">Category</param>
public virtual void DeleteCategory(Category category)
{
if (category == null)
throw new ArgumentNullException(nameof(category));
if (category is IEntityForCaching)
throw new ArgumentException("Cacheable entities are not supported by Entity Framework");
category.Deleted = true;
UpdateCategory(category);
//event notification
_eventPublisher.EntityDeleted(category);
//reset a "Parent category" property of all child subcategories
var subcategories = GetAllCategoriesByParentCategoryId(category.Id, true);