The timeout period elapsed ...

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

On a EF 4 context I am doing the following:

Context context = new Context();

Func<Job, Boolean> predicat = (j => j.Id == 2);

var q1 = context.Jobs.FirstOrDefault(j => j.Id == 2);

var q2 = context.Jobs.FirstOrDefault(predicat);

In a table with 800 records and no filestream column both "q1" and "q2" work fine.

In a table with 4000 records and filestream column "q1" works fine and in "q2" I get the following error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.


Note: My code is only these 4 code lines and the context.edmx file.

Any idea?

Thank You,

Miguel
 
On a EF 4 context I am doing the following:

Context context = new Context();

Func<Job, Boolean> predicat = (j => j.Id == 2);

var q1 = context.Jobs.FirstOrDefault(j => j.Id == 2);

var q2 = context.Jobs.FirstOrDefault(predicat);

In a table with 800 records and no filestream column both "q1" and "q2" work fine.

In a table with 4000 records and filestream column "q1" works fine and in "q2" I get the following error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Note: My code is only these 4 code lines and the context.edmx file.

Any idea?

Is it consistent that q1 work and q2 fail if you only call one or call
it multiple times etc.?

Arne
 
Hello Arne,

Sorry for the delay. I was able to solve it by using:
Expression<Func<T, Boolean>>
 
Back
Top