ISponsor Interface


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

public interface class ISponsor
public interface ISponsor
public interface ISponsor
type ISponsor = interface
type ISponsor = interface
Public Interface ISponsor


public ref class MyClientSponsor: public MarshalByRefObject, public ISponsor
   DateTime lastRenewal;

      lastRenewal = DateTime::Now;

   virtual TimeSpan Renewal( ILease^ /* lease */ )
      Console::WriteLine( "Request to renew the lease time." );
      Console::WriteLine( "Time since last renewal: {0}",
         DateTime::Now - lastRenewal );

      lastRenewal = DateTime::Now;
      return TimeSpan::FromSeconds( 20 );
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);
Public Class MyClientSponsor
   Inherits MarshalByRefObject
   Implements ISponsor 
   Private lastRenewal As DateTime
   Public Sub New()
      lastRenewal = DateTime.Now
   End Sub
   <SecurityPermission(SecurityAction.LinkDemand, Flags := SecurityPermissionFlag.Infrastructure)> _
   Public Function Renewal(lease As ILease) As TimeSpan Implements ISponsor.Renewal
      Console.WriteLine("Request to renew the lease time.")
      Console.WriteLine("Time since last renewal: " + _ 
                      DateTime.op_Subtraction(DateTime.Now, lastRenewal).ToString())
      lastRenewal = DateTime.Now
      Return TimeSpan.FromSeconds(20)
   End Function 'Renewal
End Class


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.



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

Applies to