The timeout period elapsed ...

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
 
A

Arne Vajhøj

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
 
S

Shapper

Hello Arne,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top