In my project one table is connected with two or more tables ,To require wanted out put need to join them,Join is not my problem ,after join want to select desired column but from a segregate expression , as like bellow syntax:
public IEnumerable GetParent(string organogramType = "")
{
var query = (from p in this.Context.CmnCompanies
where organogramType != "" && !p.OrganogramType.Contains(organogramType) && p.OrganogramType != null
join r in this.Context.CmnCompanyCategories on p.CompanyCategoryID equals r.CompanyCategoryID
join s in this.Context.CmnCompanyReferences on p.RefID equals s.RefID
join t in this.Context.CmnPartnerDetails on p.PartnerID equals t.PartnerID).Select(SelectSearchColumns).ToList();
return query;
}
public Expression<Func<CmnCompany, CmnCompanyReference, CmnPartnerDetail, dynamic>> SelectSearchColumns = (p, r,t) => new
{
CompanyID = p.CompanyID,
CompanyName=p.CompanyName,
PartnerName=t.PartnerName,
OrganogramType=p.OrganogramType,
ParentID=p.ParentID,
InceptionDate=p.InceptionDate,
RefName=r.RefName,
};
Want to segregate select statement from my bellow linq syntax
base on method
parameter=organogramType
select column name will be change supposeorganogramType (Company, office, departmentName) office
then select columnn“CompanyName “
will be chage with Office,how to chage column name on run time
Show me ERROR MESSAGE: A query body must end with a select clause or a group clause
If have any query please ,thanks in advanced