RelationalDatabaseFacadeExtensions.SetCommandTimeout Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SetCommandTimeout(DatabaseFacade, Nullable<Int32>) |
Sets the timeout (in seconds) to use for commands executed with this DbContext. |
SetCommandTimeout(DatabaseFacade, TimeSpan) |
Sets the timeout to use for commands executed with this DbContext. |
SetCommandTimeout(DatabaseFacade, Nullable<Int32>)
Sets the timeout (in seconds) to use for commands executed with this DbContext.
public static void SetCommandTimeout (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, int? timeout);
static member SetCommandTimeout : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * Nullable<int> -> unit
<Extension()>
Public Sub SetCommandTimeout (databaseFacade As DatabaseFacade, timeout As Nullable(Of Integer))
Parameters
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
Remarks
If this value is set, then it is used to set CommandTimeout whenever Entity Framework creates a DbCommand to execute a query.
If this value is not set, then the default value used is defined by the underlying ADO.NET data provider. Consult the documentation for the implementation of DbCommand in the ADO.NET data provider for details of default values, etc.
Note that the command timeout is distinct from the connection timeout. Connection timeouts are usually configured in the connection string. More recently, some ADO.NET data providers are adding the capability to also set a command timeout in the connection string. A value set with this API for the command timeout will override any value set in the connection string.
See Connections and connection strings for more information and examples.
Applies to
SetCommandTimeout(DatabaseFacade, TimeSpan)
Sets the timeout to use for commands executed with this DbContext.
public static void SetCommandTimeout (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, TimeSpan timeout);
static member SetCommandTimeout : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * TimeSpan -> unit
<Extension()>
Public Sub SetCommandTimeout (databaseFacade As DatabaseFacade, timeout As TimeSpan)
Parameters
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
- timeout
- TimeSpan
The timeout to use.
Remarks
This is a sugar method allowing a TimeSpan to be used to set the value. It delegates to SetCommandTimeout(DatabaseFacade, Nullable<Int32>).
See Connections and connection strings for more information and examples.
Applies to
Entity Framework