Page 1 of 1
Linq query taking lot of time to execute
Posted: Thu 13 Oct 2011 00:07
by annantDev
I have one linq query which is simply retrieving a list of values based on one where condition. But, the query is taking lot of time to execute. I can see that in DBMonitor. Also, when I excute the same sql query on the sql developer, then it executes instantly.
Can anyone plz guide me on this?
Thanks.
Posted: Thu 13 Oct 2011 03:04
by kseen
I think you are should attach code for solving your issue quickler.
Posted: Thu 13 Oct 2011 15:14
by annantDev
This is my code -
public IEnumerable Get(string ProgramNumber)
{
var cplItems = (from c in context.CPLs
where c.ProgramNumber == ProgramNumber
select new CPL
{
CPLId = c.CPLId,
CPLName = c.CPLName,
Revision = c.Revision,
ReleaseDate = c.CPLReleaseDate
});
return cplItems.ToList();
}
Posted: Thu 13 Oct 2011 17:17
by annantDev
The issue is resolved now.
Thanks!
Posted: Fri 14 Oct 2011 12:40
by StanislavK
Glad to see that the problem was resolved. Could you please specify what should be changed to fix it?
JIC: the code you've specified seems to be incorrect, as explicit calls of entity class constructors are not allowed in LinqConnect queries. As far as I can understand, the query should be
Code: Select all
var cplItems =
from c in context.CPLs
where c.ProgramNumber == ProgramNumber
select c;