Share via


SecurityCallContext.CurrentCall Propriedade

Definição

Obtém um objeto SecurityCallContext que descreve o contexto de chamada de segurança.

public:
 static property System::EnterpriseServices::SecurityCallContext ^ CurrentCall { System::EnterpriseServices::SecurityCallContext ^ get(); };
public static System.EnterpriseServices.SecurityCallContext CurrentCall { get; }
static member CurrentCall : System.EnterpriseServices.SecurityCallContext
Public Shared ReadOnly Property CurrentCall As SecurityCallContext

Valor da propriedade

O SecurityCallContext objeto que descreve o contexto de chamada de segurança.

Exemplos

O exemplo de código a seguir demonstra o uso desse método para obter um SecurityCallContext objeto que descreve o contexto de segurança de uma chamada de método.

// Set the employee's salary. Only managers can do this.
void SetSalary( double ammount )
{
   if ( SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) )
   {
      salary = ammount;
   }
   else
   {
      throw gcnew UnauthorizedAccessException;
   }
}
// Set the employee's salary. Only managers can do this.
public void SetSalary (double ammount)
{
    if (SecurityCallContext.CurrentCall.IsCallerInRole("Manager"))
    {
        salary = ammount;
    }
    else
    {
        throw new UnauthorizedAccessException();
    }
}
' Set the employee's salary. Only managers can do this.
Public Sub SetSalary(ByVal ammount As Double) 
    If SecurityCallContext.CurrentCall.IsCallerInRole("Manager") Then
        salary = ammount
    Else
        Throw New UnauthorizedAccessException()
    End If

End Sub

Comentários

A propriedade estática CurrentCall é a maneira recomendada de acessar o contexto de chamada de segurança.

Aplica-se a