Share via


LicFileLicenseProvider.GetLicense 메서드

정의

구성 요소의 인스턴스에 대한 라이선스를 사용할 수 있으면 해당 라이선스를 반환합니다.

public:
 override System::ComponentModel::License ^ GetLicense(System::ComponentModel::LicenseContext ^ context, Type ^ type, System::Object ^ instance, bool allowExceptions);
public override System.ComponentModel.License GetLicense (System.ComponentModel.LicenseContext context, Type type, object instance, bool allowExceptions);
public override System.ComponentModel.License? GetLicense (System.ComponentModel.LicenseContext context, Type type, object? instance, bool allowExceptions);
override this.GetLicense : System.ComponentModel.LicenseContext * Type * obj * bool -> System.ComponentModel.License
Public Overrides Function GetLicense (context As LicenseContext, type As Type, instance As Object, allowExceptions As Boolean) As License

매개 변수

context
LicenseContext

라이선스가 있는 개체를 사용할 수 있는 경우를 지정하는 LicenseContext입니다.

type
Type

Type를 요청하는 구성 요소를 나타내는 License입니다.

instance
Object

License를 요청하는 개체입니다.

allowExceptions
Boolean

구성 요소에 라이선스를 부여할 수 없는 경우 LicenseException이 throw되면 true이고, 그렇지 않으면 false입니다.

반환

유효한 License입니다. 이 메서드는 유효한 License나 유효한 context 매개 변수를 찾을 수 없는 경우 null을 반환합니다.

설명

디자인 타임에 메서드는 GetLicense 라는 myClassName.LIC라이선스 파일을 찾습니다. 여기서 myClassName 는 만들 구성 요소의 입니다 FullName . 이 파일은 구성 요소가 포함된 .dll 파일과 동일한 디렉터리에 있어야 합니다.

다음으로, 이 메서드는 메서드에 지정된 IsKeyValid 키에 대해 라이선스 파일의 첫 번째 줄을 확인합니다. 키가 유효한 경우 이 줄은 로 LicenseKey사용됩니다.

적용 대상

추가 정보