Share via


ServicedComponent.Activate Methode

Definition

Wird von der Infrastruktur aufgerufen, wenn das Objekt erstellt oder in einem Pool reserviert wird. Überschreiben Sie diese Methode, um Objekten benutzerdefinierten Initialisierungscode hinzuzufügen.

protected public:
 virtual void Activate();
protected internal virtual void Activate ();
abstract member Activate : unit -> unit
override this.Activate : unit -> unit
Protected Friend Overridable Sub Activate ()

Beispiele

Im folgenden Codebeispiel wird die Verwendung dieser Methode veranschaulicht.

protected:
   virtual void Activate() override
   {
      MessageBox::Show( String::Format( "Now entering...\nApplication: {0}\nInstance: {1}\nContext: {2}\n", ContextUtil::ApplicationId.ToString(), ContextUtil::ApplicationInstanceId.ToString(), ContextUtil::ContextId.ToString() ) );
   }
protected override void Activate()
{
    MessageBox.Show( String.Format("Now entering...\nApplication: {0}\nInstance: {1}\nContext: {2}\n",
                                   ContextUtil.ApplicationId.ToString(), ContextUtil.ApplicationInstanceId.ToString(),
                                   ContextUtil.ContextId.ToString() ) );
}
Protected Overrides Sub Activate() 
    MessageBox.Show(String.Format("Now entering..." + vbLf + "Application: {0}" + vbLf + "Instance: {1}" + vbLf + "Context: {2}" + vbLf, ContextUtil.ApplicationId.ToString(), ContextUtil.ApplicationInstanceId.ToString(), ContextUtil.ContextId.ToString()))

End Sub

Gilt für: