To make linq query faster
Hi All,What should I do to make the following linq query faster? The database got heaps of records in it. This query actually followed by foreach loop and then again another query and foreach loop. It takes much time to load.
Help will be appreciated. Thank you.
var hours = from hr in objHours.Distinct()
where hr.EmployeeID == empGuid && hr.JobId == j.JID && hr.CatId == j.CatId.ToInt() && hr.Date.Year == DateTime.Now.Year
orderby hr.TID descending
select new
{
hr.Hour,
hr.Date,
hr.CatId
};