Table of Contents

Struct TemporaryCommandTimeout

Namespace
LfrlAnvil.Sql.Internal
Assembly
LfrlAnvil.Sql.Core.dll

Represents a lightweight disposable object that swaps IDbCommand timeout.

public readonly struct TemporaryCommandTimeout : IDisposable
Implements
Inherited Members

Constructors

TemporaryCommandTimeout(IDbCommand, TimeSpan?)

Creates a new TemporaryCommandTimeout instance.

public TemporaryCommandTimeout(IDbCommand command, TimeSpan? timeout)

Parameters

command IDbCommand

Command to swap CommandTimeout for.

timeout TimeSpan?

Optional timeout to set. Lack of value will cause the timeout to not be changed.

Exceptions

ArgumentException

When timeout is less 0.

Properties

Command

Underlying IDbCommand instance.

public IDbCommand Command { get; }

Property Value

IDbCommand

PreviousTimeout

CommandTimeout of Command before the change.

public int PreviousTimeout { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Remarks

Sets PreviousTimeout as timeout of the Command.