using FruitBank.Common.Dtos; using LinqToDB; using Mango.Nop.Data.Repositories; using Nop.Core.Caching; using Nop.Core.Configuration; using Nop.Core.Domain.Catalog; using Nop.Core.Events; using Nop.Data; using Mango.Nop.Core.Loggers; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; public class ProductDtoDbTable : MgDtoDbTableBase { public ProductDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings) { } public IQueryable GetAll(bool loadRelations, bool includeDeleted = false) { return GetAll().Where(p => includeDeleted || !p.Deleted) .LoadWith(p => p.GenericAttributes); } public Task GetByIdAsync(int productId, bool loadRelations, bool includeDeleted = false) => GetAll(loadRelations).Where(x => x.Id == productId).FirstOrDefaultAsync(null); public IQueryable GetAllByIds(IEnumerable productIds, bool loadRelations = true, bool includeDeleted = false) => GetAll(loadRelations).Where(p => productIds.Contains(p.Id)); }