Provides methods that control the lifetime of an add-in.
Assembly: System.AddIn (in System.AddIn.dll)
Gets the instance of the add-in-side adapter when the application domain was created.
Determines whether an application domain is owned by the specified contract.
Revokes the lifetime token on a contract, regardless of input.
Revokes the lifetime token on the contract regardless of input and optionally releases the managed resources.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Releases the resources associated with the Object.Finalize().)instance.(Overrides
Serves as the default hash function. (Inherited from Object.)
Returns a string that represents the current object.(Inherited from Object.)
Because the add-in model provides the ability for add-ins to communicate between application domains and between processes, it cannot rely on the garbage collector to reclaim them. This class provides a reference counting mechanism for the add-in by obtaining a lifetime token to its contract.
When a AcquireLifetimeToken method on the contract that is passed to the constructor. When the object is disposed or finalized, it calls the RevokeLifetimeToken method on the contract, which removes its hold on the contract.object is constructed, it calls the
Adapters implement the contract. Theclass is designed to be used in a contract-to-view adapter to help pipeline developers manage the lifetime of the contract that is being adapted. Typically, an instance of this class is instantiated during the construction of the adapter class and is stored in an instance field of the adapter. When the adapter class is garbage-collected, the object will also be collected and the object will revoke the lifetime token on the contract.
It is recommended that your view-to-contract adapters inherit from the ContractBase class. You can then use a default implementation for the members of IContract, which means you need to implement only the members of your specific contract.
The following example shows how to set the lifetime token handle in a contract-to-view adapter on the add-in side of a pipeline.
Available since 3.5
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.