+1  A: 

Set ConnectionTimeout to a low value

gbn
I tried that already, sorry I didn't mention that. It changes nothing, it is as if it is being ignored. I tried setting it in the connection string and on the ObjectConntext as well.
Rodney Foley
hhhmm. perhaps it's being set elsewhere.
gbn
Do you know where else this could set than on the Connection itself or on the ObjectContext? Or what could be overriding, or why it would be getting ignored?
Rodney Foley
Sorry, I don't...
gbn
+1  A: 

There really is no easy or quick way to resolve this. The ConnectionTimeout value is getting ignored with the Entity Framework. The solution I used is creating a method that checks if a context is valid by passing in the location you which to validate and then it getting the count from a known very small table. If this throws an exception the context is not valid otherwise it is. Here is some sample code showing this.

public bool IsContextValid(SomeDbLocation location)
{
    bool isValid = false;

    try
    {
        context = GetContext(location);
        context.SomeSmallTable.Count();
        isValid = true;                
    }
    catch
    {
        isValid = false;
    }

    return isValid;
}
Rodney Foley

related questions