I have method that returns function for companySurveys
Here is it
private Func<IQueryable<Client>, IQueryable<CompanySurvey>> JoinCompanySurvey(int id,
IQueryable<CompanySurvey> companuSurveyQuery)
{
var function = (IQueryable<Client> companies) => from companySurvey in companuSurveyQuery
where companySurvey.Id == id
join company in companies
on companySurvey.CompanyId equals company.CompanyId
into res
from company in res
select companySurvey;
return function;
}
id parameter is companySurvey ID.
I need method that can work with list of id's.
So I can send here List and return function for many companySurveys
So same stuff as now, but for many.
How I need to rewrite this method?
How about this, change parameter int Id
to IEnumerable<int> ids
and in the func body change companySurvey.Id == id
to ids.Contains(companySurvey.Id)
private Func<IQueryable<Client>, IQueryable<CompanySurvey>> JoinCompanySurvey(IEnumberable<int> ids,
IQueryable<CompanySurvey> companuSurveyQuery)
{
var function = (IQueryable<Client> companies) => from companySurvey in companuSurveyQuery
where ids.Contains(companySurvey.Id)
join company in companies
on companySurvey.CompanyId equals company.CompanyId
into res
from company in res
select companySurvey;
return function;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.