ISponsor Interface

Definition

Indicates that the implementer wants to be a lifetime lease sponsor.

C#
public interface ISponsor
C#
[System.Runtime.InteropServices.ComVisible(true)]
public interface ISponsor
Derived
Attributes

Examples

C#
public class MyClientSponsor : MarshalByRefObject, ISponsor
{
   private DateTime lastRenewal;
   public MyClientSponsor()
   {
      lastRenewal = DateTime.Now;
   }

   public TimeSpan Renewal(ILease lease)
   {
      Console.WriteLine("Request to renew the lease time.");
      Console.WriteLine("Time since last renewal: " +
         (DateTime.Now - lastRenewal).ToString());

      lastRenewal = DateTime.Now;
      return TimeSpan.FromSeconds(20);
   }
}

Remarks

An object must implement the ISponsor interface if it needs to request a lease renewal for a particular object. An object that implements the ISponsor interface can become a sponsor by registering itself with the lease manager. The ISponsor interface is used by the lifetime service to call back to the sponsor.

Methods

Renewal(ILease)

Requests a sponsoring client to renew the lease for the specified object.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1