using System.Collections.Generic; using System.Linq; using Portoa.Persistence; namespace VideoGameQuotes.Api.Persistence { public interface ISearchService where T : Entity { IEnumerable FindByIds(IEnumerable ids); IEnumerable GetAllIndexableRecords(); } public class SearchService : ISearchService where T : Entity { private readonly IRepository repository; public SearchService(IRepository repository) { this.repository = repository; } [UnitOfWork] public IEnumerable FindByIds(IEnumerable ids) { return repository .Records .Where(entity => ids.ToArray().Contains(entity.Id)); } [UnitOfWork] public IEnumerable GetAllIndexableRecords() { return repository.Records; } } }