SqlContext.IsAvailable Propriedade

Definição

Especifica se o código de chamada está em execução no SQL Server e se é possível acessar a conexão de contexto.Specifies whether the calling code is running within SQL Server, and if the context connection can be accessed.

public:
 static property bool IsAvailable { bool get(); };
public static bool IsAvailable { get; }
member this.IsAvailable : bool
Public Shared ReadOnly Property IsAvailable As Boolean

Valor da propriedade

Boolean

True se a conexão de contexto estiver disponível e os outros SqlContext Membros puderem ser acessados.True if the context connection is available and the other SqlContext members can be accessed.

Comentários

Se essa propriedade retornar false, todos os outros SqlContext Membros lançarão um InvalidOperationException se for usado.If this property returns false, all the other SqlContext members throw an InvalidOperationException if used.

Se essa propriedade retornar false, qualquer tentativa de abrir um objeto de conexão que tenha "context connection = true" na cadeia de conexão falhará.If this property returns false, any attempt to open a connection object that has "context connection=true" in the connection string fails.

Esta propriedade é somente para leitura.This property is read-only.

Ao usar o ADO.NET para acesso a dados, se um trecho de código puder ser executado dentro de SQL Server (usando a integração Common Language Runtime) e fora do SQL Server, essa propriedade poderá ser usada para verificar se a conexão de contexto está disponível.When using ADO.NET for data-access, if a piece of code may run both inside SQL Server (using common language runtime integration) and outside SQL Server, this property can be used to check whether the context connection is available.

Aplica-se a