using Abp.Linq.Extensions;
public class AddressAppService : MyAppAppServiceBase, IAddressAppService
{
public AddressAppService(IRepository<AdrAddress> addressRepository,
IRepository<AdrPersonCompany> personCompanyRepository,
IRepository<AdrAddressPersonCompany> addressPersonCompanyRepository,
IRepository<AdrTitle> titleRepository,
IDbContextProvider<TreasureMapDbContext> dbContextProvider)
{
_addressRepository = addressRepository;
_personCompanyRepository = personCompanyRepository;
_addressPersonCompanyRepository = addressPersonCompanyRepository;
_titleRepository = titleRepository;
_dbContextProvider = dbContextProvider;
}
public ListResultDto<AddressPersonCompanyDto> GetAddressPersonCompanies(GetAddressesInput input)
{
var searchwords = !input.Filter.IsNullOrEmpty() ? input.Filter.Split(" ") : null;
var addressPersonCompanies = _addressPersonCompanyRepository
.GetAll()
.Include(adr => adr.Address)
.Include(pers => pers.PersonCompany)
.Include(tit => tit.PersonCompany.Title)
.WhereIf(
!input.Filter.IsNullOrEmpty(),
e => searchwords.All(w => String
.Join(" ", e.PersonCompany.NameCompany, e.PersonCompany.Firstname, e.Address.Street, e.Address.Location)
.Contains(w, StringComparison.InvariantCultureIgnoreCase))
)
.ToList();
return new ListResultDto<AddressPersonCompanyDto>(ObjectMapper.Map<List<AddressPersonCompanyDto>>(addressPersonCompanies));
}
}
Does that help you?
Hi maliming, you are right. But I think the problem also has something to do with the namespace Abp.Linq.Extensions. Running the query ....ToList() without using Abp.Linq.Extensions namespace works as expected. If I add the namespace, there is an error.
On the other side ...AsQueryable() doesn't work with or without the namespace Abp.Linq.Extensions.