I have the following linq which i want to pass different conditions to the where clause,but i get error:
var rslt = (from t in cr.faultStatAlt
join v in cr.errorCatGroup
on t.m_error_id equals v.m_error_id
join h in cr.masterAlarm on t.m_inv_error_details equals h.pc_group_pattern into ps
from h in ps.DefaultIfEmpty()
join s in cr.MasterDataTurbine on t.m_turbine_id equals s.m_turbine_id
where (whereClause)
group t.error_duration by v.m_error_subgroup_name into k
select new faulttest
{
m_error_subgroup = k.Key,
error_duration = Math.Round(k.Sum() / 3600, 2)
}).ToString();
the condition i want to make it dynamic is :
Func<t_fault_stat_alt, bool> whereClause = t => t.m_date >= dt1 && t.m_date <= dt2 && t.m_grid_loss==true;