Table of Contents

NotableDatePluginHandle Class

Definition

Namespace
Bodu.Globalization.Calendar.Plugins
Assembly
Bodu.Globalization.Calendar.Plugins.dll
Package
Bodu.Globalization.Calendar.Plugins 1.0.0
Source
NotableDatePluginHandle.cs

Owns an activated plugin together with its dedicated AssemblyLoadContext, so the plugin's assemblies can be unloaded when the handle is disposed.

public sealed class NotableDatePluginHandle : IDisposable
Inheritance
NotableDatePluginHandle
Implements
Inherited Members
Extension Methods

Remarks

A handle is produced by LoadFromFile(string, IPluginTrustPolicy, ILogger?). Disposing it initiates an unload of the plugin's collectible load context; the runtime reclaims the context only once nothing references the plugin's types any longer. In particular, algorithms the plugin registered into a NotableDateAlgorithmRegistry - and any service holding that registry - keep the context alive until they are discarded, so tear down consumers of the plugin before (or promptly after) disposing the handle.

Disposal is idempotent. The Plugin must not be used after the handle is disposed.

Properties

IsUnloadable

Gets a value indicating whether disposing the handle initiates an unload of the plugin's load context.

public bool IsUnloadable { get; }

Property Value

bool

true while the handle owns a collectible context that has not yet been unloaded; otherwise false.

Plugin

Gets the activated plugin.

public INotableDatePlugin Plugin { get; }

Property Value

INotableDatePlugin

The plugin instance the loader activated.

Methods

Dispose()

Initiates an unload of the plugin's load context. Safe to call more than once.

public void Dispose()

Applies to

ProductVersions
.NET8, 10

See Also