Linq query taking lot of time to execute

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
annantDev
Posts: 3
Joined: Wed 12 Oct 2011 23:46

Linq query taking lot of time to execute

Post by annantDev » Thu 13 Oct 2011 00:07

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.

kseen
Posts: 9
Joined: Thu 06 Oct 2011 10:16

Post by kseen » Thu 13 Oct 2011 03:04

I think you are should attach code for solving your issue quickler.

annantDev
Posts: 3
Joined: Wed 12 Oct 2011 23:46

Post by annantDev » Thu 13 Oct 2011 15:14

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();

}

annantDev
Posts: 3
Joined: Wed 12 Oct 2011 23:46

Post by annantDev » Thu 13 Oct 2011 17:17

The issue is resolved now.

Thanks!

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 14 Oct 2011 12:40

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;

Post Reply