ObjectContext.CommandTimeout Property


Gets or sets the timeout value, in seconds, for all object context operations. A null value indicates that the default value of the underlying provider will be used.

Namespace:   System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

member CommandTimeout : Nullable<int> with get, set

Property Value

Type: System.Nullable<Int32>

An Int32 value that is the timeout value, in seconds.

Exception Condition

The timeout value is less than 0.

The default timeout for object queries and the SaveChanges operation is defined by the underlying connection provider. However, you can override this default timeout value by using the CommandTimeout property on the ObjectContext, as shown in the following example.

No code example is currently available or this language may not be supported.

Do this when you have a complex query or when other performance issues cause queries or calls to SaveChanges to time out frequently.

.NET Framework
Available since 3.5
Return to top