LicenseProviderAttribute 클래스

정의

클래스와 함께 사용할 LicenseProvider를 지정합니다. 이 클래스는 상속될 수 없습니다.

public ref class LicenseProviderAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public sealed class LicenseProviderAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)>]
type LicenseProviderAttribute = class
    inherit Attribute
Public NotInheritable Class LicenseProviderAttribute
Inherits Attribute
상속
LicenseProviderAttribute
특성

예제

다음 코드 예제에서는 를 의 MyControl라이선스 공급자로 사용합니다LicFileLicenseProvider.

[LicenseProvider(LicFileLicenseProvider::typeid)]
ref class MyControl: public Control
{
protected:

   // Insert code here.
   ~MyControl()
   {
      /* All components must dispose of the licenses they grant. 
               * Insert code here to dispose of the license. */
   }
};
[LicenseProvider(typeof(LicFileLicenseProvider))]
 public class MyControl : Control {
 
    // Insert code here.
 
    protected override void Dispose(bool disposing) {
       /* All components must dispose of the licenses they grant. 
        * Insert code here to dispose of the license. */
    }
 }
<LicenseProvider(GetType(LicFileLicenseProvider))> _
Public Class MyControl
    Inherits Control
    
    ' Insert code here.
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        ' All components must dispose of the licenses they grant.
        ' Insert code here to dispose of the license.
    End Sub        

End Class

다음 코드 예제에서는 클래스의 인스턴스를 MyControl 만듭니다. 그런 다음 클래스의 특성을 가져오고 에서 사용하는 myNewControl라이선스 공급자의 이름을 출력합니다.

int main()
{
   // Creates a new component.
   MyControl^ myNewControl = gcnew MyControl;

   // Gets the attributes for the component.
   AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewControl );

   /* Prints the name of the license provider by retrieving the LicenseProviderAttribute 
        * from the AttributeCollection. */
   LicenseProviderAttribute^ myAttribute = dynamic_cast<LicenseProviderAttribute^>(attributes[ LicenseProviderAttribute::typeid ]);
   Console::WriteLine( "The license provider for this class is: {0}", myAttribute->LicenseProvider );
   return 0;
}
public static int Main() {
    // Creates a new component.
    MyControl myNewControl = new MyControl();
 
    // Gets the attributes for the component.
    AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewControl);
 
    /* Prints the name of the license provider by retrieving the LicenseProviderAttribute 
     * from the AttributeCollection. */
    LicenseProviderAttribute myAttribute = (LicenseProviderAttribute)attributes[typeof(LicenseProviderAttribute)];
    Console.WriteLine("The license provider for this class is: " + myAttribute.LicenseProvider.ToString());
 
    return 0;
 }
Public Shared Function Main() As Integer
    ' Creates a new component.
    Dim myNewControl As New MyControl()
    
    ' Gets the attributes for the component.
    Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewControl)
    
    ' Prints the name of the license provider by retrieving the LicenseProviderAttribute 
    ' from the AttributeCollection. 
    Dim myAttribute As LicenseProviderAttribute = _
        CType(attributes(GetType(LicenseProviderAttribute)), LicenseProviderAttribute)
        
    Console.WriteLine(("The license provider for this class is: " & _
        myAttribute.LicenseProvider.ToString()))
    Return 0
End Function

설명

라이선스를 부여하려는 구성 요소를 만들 때 구성 요소를 로 표시하여 를 LicenseProviderAttribute지정 LicenseProvider 해야 합니다.

LicenseProvider 속성을 사용하여 의 을 Type 가져옵니다LicenseProvider.

특성에 대한 자세한 내용은 특성을 참조하세요. 라이선스에 대한 자세한 내용은 방법: 라이선스 구성 요소 및 컨트롤을 참조하세요.

참고

합니다 HostProtectionAttribute 이 클래스에 적용 된 특성에는 다음과 같은 Resources 속성 값: SharedState합니다. HostProtectionAttribute는 대개 아이콘을 두 번 클릭하거나, 명령을 입력하거나, 브라우저에서 URL을 입력하여 시작되는 데스크톱 애플리케이션에 영향을 미치지 않습니다. 자세한 내용은 참조는 HostProtectionAttribute 클래스 또는 SQL Server 프로그래밍 및 호스트 보호 특성합니다.

생성자

LicenseProviderAttribute()

라이선스 공급자를 사용하지 않고 LicenseProviderAttribute 클래스의 새 인스턴스를 초기화합니다.

LicenseProviderAttribute(String)

지정된 형식을 사용하여 LicenseProviderAttribute 클래스의 새 인스턴스를 초기화합니다.

LicenseProviderAttribute(Type)

지정된 라이선스 공급자 형식을 사용하여 LicenseProviderAttribute 클래스의 새 인스턴스를 초기화합니다.

필드

Default

기본값인 공급자가 없음을 지정합니다. 이 static 필드는 읽기 전용입니다.

속성

LicenseProvider

관련 클래스와 함께 사용해야 할 라이선스 공급자를 가져옵니다.

TypeId

이 특성 형식의 고유 ID를 나타냅니다.

메서드

Equals(Object)

이 인스턴스와 지정된 개체가 같은지 여부를 나타냅니다.

GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보