แก้ไข

แชร์ผ่าน


ServicedComponent.Activate Method

Definition

Called by the infrastructure when the object is created or allocated from a pool. Override this method to add custom initialization code to objects.

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 ()

Examples

The following code example demonstrates the use of this method.

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

Applies to