LicenseManager クラス
アセンブリ: System (system.dll 内)


LicenseManager クラスでは、static プロパティ (CurrentContext と UsageMode) が提供されます。また、このクラスでは、static メソッド (CreateWithContext、IsValid、および Validate) も提供されます。
ライセンスを与える対象となるコンポーネントを作成する場合は、次の処理を行う必要があります。
-
LicenseProviderAttribute を使用してコンポーネントをマークすることによって、LicenseProvider を指定します。
-
コンポーネントのコンストラクタで Validate または IsValid を呼び出します。有効なライセンスがないのにインスタンスを作成しようとすると、Validate は LicenseException をスローします。IsValid は例外をスローしません。
ライセンスの詳細については、「方法 : コンポーネントおよびコントロールのライセンス処理を行う」を参照してください。
![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、ExternalProcessMgmt です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

Validate メソッドを使用して、複数のライセンス コントロールを作成するコード例を次に示します。このコード例では、LicFileLicenseProvider クラスで実装される LicenseProvider が使用されます。
Imports System Imports System.ComponentModel Imports System.Windows.Forms ' Adds the LicenseProviderAttribute to the control. <LicenseProvider(GetType(LicFileLicenseProvider))> _ Public Class MyControl Inherits Control ' Creates a new, null license. Private license As License = Nothing Public Sub New() ' Adds Validate to the control's constructor. license = LicenseManager.Validate(GetType(MyControl), Me) ' Insert code to perform other instance creation tasks here. End Sub Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (license Is Nothing) Then license.Dispose() license = Nothing End If End If End Sub End Class
using System; using System.ComponentModel; using System.Windows.Forms; // Adds the LicenseProviderAttribute to the control. [LicenseProvider(typeof(LicFileLicenseProvider))] public class MyControl : Control { // Creates a new, null license. private License license = null; public MyControl () { // Adds Validate to the control's constructor. license = LicenseManager.Validate(typeof(MyControl), this); // Insert code to perform other instance creation tasks here. } protected override void Dispose(bool disposing) { if(disposing) { if (license != null) { license.Dispose(); license = null; } } } }
// Adds the LicenseProviderAttribute to the control. [LicenseProvider(LicFileLicenseProvider::typeid)] public ref class MyControl: public Control { // Creates a new, null license. private: License^ license; public: MyControl() { // Adds Validate to the control's constructor. license = LicenseManager::Validate( MyControl::typeid, this ); // Insert code to perform other instance creation tasks here. } public: ~MyControl() { if ( license != nullptr ) { delete license; license = nullptr; } } };
import System.*; import System.ComponentModel.*; import System.Windows.Forms.*; // Adds the LicenseProviderAttribute to the control. /** @attribute LicenseProvider(LicFileLicenseProvider.class) */ public class MyControl extends Control { // Creates a new, null license. private License license = null; public MyControl() { // Adds Validate to the control's constructor. license = LicenseManager.Validate(MyControl.class.ToType(), this); // Insert code to perform other instance creation tasks here. } protected void Dispose(boolean disposing) { if (disposing) { if (license != null) { license.Dispose(); license = null; } } } }

System.ComponentModel.LicenseManager


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LicenseManager プロパティ

名前 | 説明 | |
---|---|---|
![]() | CurrentContext | ライセンス付きのオブジェクトをいつ使用できるかを指定する現在の LicenseContext を取得または設定します。 |
![]() | UsageMode | CurrentContext においてライセンス付きのオブジェクトをいつ使用できるかを指定する LicenseUsageMode を取得します。 |

LicenseManager メソッド

名前 | 説明 | |
---|---|---|
![]() | CreateWithContext | オーバーロードされます。 ライセンス コンテキストを持つオブジェクト型のインスタンスを作成します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsLicensed | 指定した型が有効なライセンスを与えられているかどうかを示す値を返します。 |
![]() | IsValid | オーバーロードされます。 有効なライセンスを与えることができるかどうかを判断します。 |
![]() | LockContext | 指定したオブジェクトの現在の LicenseContext を変更できないようにします。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
![]() | UnlockContext | 指定したオブジェクトの現在の LicenseContext を変更できるようにします。 |
![]() | Validate | オーバーロードされます。 ライセンスを与えることができるかどうかを判断します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

LicenseManager メンバ
コンポーネントにライセンスを与え、LicenseProvider を管理するためのプロパティとメソッドを提供します。このクラスは継承できません。
LicenseManager データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | CurrentContext | ライセンス付きのオブジェクトをいつ使用できるかを指定する現在の LicenseContext を取得または設定します。 |
![]() | UsageMode | CurrentContext においてライセンス付きのオブジェクトをいつ使用できるかを指定する LicenseUsageMode を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | CreateWithContext | オーバーロードされます。 ライセンス コンテキストを持つオブジェクト型のインスタンスを作成します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsLicensed | 指定した型が有効なライセンスを与えられているかどうかを示す値を返します。 |
![]() | IsValid | オーバーロードされます。 有効なライセンスを与えることができるかどうかを判断します。 |
![]() | LockContext | 指定したオブジェクトの現在の LicenseContext を変更できないようにします。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
![]() | UnlockContext | 指定したオブジェクトの現在の LicenseContext を変更できるようにします。 |
![]() | Validate | オーバーロードされます。 ライセンスを与えることができるかどうかを判断します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- LicenseManagerのページへのリンク