Bagikan melalui


SecurityCallContext.CurrentCall Properti

Definisi

SecurityCallContext Mendapatkan objek yang menjelaskan konteks panggilan keamanan.

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

Nilai Properti

Objek SecurityCallContext yang menjelaskan konteks panggilan keamanan.

Contoh

Contoh kode berikut menunjukkan penggunaan metode ini untuk mendapatkan objek yang SecurityCallContext menjelaskan konteks keamanan panggilan metode.

// 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

Keterangan

Properti statis CurrentCall adalah cara yang disarankan untuk mengakses konteks panggilan keamanan.

Berlaku untuk