LicenseManagerとは? わかりやすく解説

LicenseManager クラス

コンポーネントにライセンスを与え、LicenseProvider を管理するためのプロパティとメソッドを提供します。このクラスは継承できません。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

Public NotInheritable Class
 LicenseManager
Dim instance As LicenseManager
public sealed class LicenseManager
public ref class LicenseManager sealed
public final class LicenseManager
public final class LicenseManager
解説解説

LicenseManager クラスでは、static プロパティ (CurrentContext と UsageMode) が提供されます。また、このクラスでは、static メソッド (CreateWithContext、IsValid、および Validate) も提供されます。

ライセンスを与える対象となるコンポーネントを作成する場合は、次の処理を行う必要があります。

  1. LicenseProviderAttribute を使用してコンポーネントをマークすることによって、LicenseProvider を指定します。

  2. コンポーネントのコンストラクタで Validate または IsValid を呼び出します。有効なライセンスがないのにインスタンスを作成しようとすると、Validate は LicenseException をスローします。IsValid は例外をスローしません。

  3. コンポーネントを破棄または終了するときに、与えられているすべてのライセンスに対して Dispose を呼び出します。

ライセンスの詳細については、「方法 : コンポーネントおよびコントロールのライセンス処理を行う」を参照してください。

メモメモ

このクラスに適用される 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.Object
  System.ComponentModel.LicenseManager
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LicenseManager メンバ
System.ComponentModel 名前空間
License クラス
LicenseContext クラス
LicenseException クラス
LicenseProvider
LicenseProviderAttribute
LicFileLicenseProvider
LicenseUsageMode

LicenseManager プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ CurrentContext ライセンス付きのオブジェクトをいつ使用できるかを指定する現在の LicenseContext を取得または設定します。
パブリック プロパティ UsageMode CurrentContext においてライセンス付きのオブジェクトをいつ使用できるかを指定する LicenseUsageMode を取得します。
参照参照

関連項目

LicenseManager クラス
System.ComponentModel 名前空間
License クラス
LicenseContext クラス
LicenseException クラス
LicenseProvider
LicenseProviderAttribute
LicFileLicenseProvider
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 オーバーロードされます。 ライセンスを与えることができるかどうかを判断します。
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

LicenseManager クラス
System.ComponentModel 名前空間
License クラス
LicenseContext クラス
LicenseException クラス
LicenseProvider
LicenseProviderAttribute
LicFileLicenseProvider
LicenseUsageMode

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 オーバーロードされます。 ライセンスを与えることができるかどうかを判断します。
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

LicenseManager クラス
System.ComponentModel 名前空間
License クラス
LicenseContext クラス
LicenseException クラス
LicenseProvider
LicenseProviderAttribute
LicFileLicenseProvider
LicenseUsageMode



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「LicenseManager」の関連用語

LicenseManagerのお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



LicenseManagerのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS