Compartilhar via


RoleEnvironmentStoppingEventArgs Class

 

Represents the arguments for the Stopping event, which occurs when a role instance is being stopped.

Namespace:   Microsoft.WindowsAzure.ServiceRuntime
Assembly:  Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentStoppingEventArgs

Syntax

public class RoleEnvironmentStoppingEventArgs : EventArgs
public ref class RoleEnvironmentStoppingEventArgs : EventArgs
type RoleEnvironmentStoppingEventArgs = 
    class
        inherit EventArgs
    end
Public Class RoleEnvironmentStoppingEventArgs
    Inherits EventArgs

Constructors

Name Description
System_CAPS_pubmethod RoleEnvironmentStoppingEventArgs()

Initializes a new instance of the RoleEnvironmentStoppingEventArgs class.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

You typically handle the Stopping event in the OnStart method for the role.

The following code example shows how to run code when the role instance is being stopped:

public override bool OnStart()
{
   RoleEnvironment.Stopping += RoleEnvironmentStopping;

   return base.OnStart();
}    

private void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e) 
{
   // Add code that is run when the role instance is being stopped
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

RoleEnvironment
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top