오늘 나는 여기에 오래된 것들을 다시 써서 대답을 모른다는 문제에 빠지게되었습니다. , 내가 예를 들어 다음 클래스에서 잘이 속성을 사용할 수 있습니다 염두에와배열 매개 변수가있는 속성 생성자
Enumeration<T> = class(TCustomAttribute)
strict private
{ Private declarations }
FValues : TList<T>;
public
{ Public declarations }
constructor Create(const AValues : array of T);
destructor Destroy(); override;
public
{ Public declarations }
property Values : TList<T> read FValues;
end;
:
내가 다음과 같은 속성을 생성[Entity('tablename')]
TUser = class(TEntity)
strict private
[Column('idcolumnname')]
[PrimaryKey(True)]
Fid : TInteger;
[Column('typecolumnname')]
[Enumeration<string>(['A', 'B', 'C', 'D', '...'])]
Ftype: TEnumeration<string>;
end;
작동하는지 훌륭하지만, idk, 그것은 내게이 일을하지 않아야한다. 내 무지에서 그러 하듯이 델파이 속성은 단지 상수 유형과 메신저를 기대한다.
는 앞을 향해 열린 길을 건너 이동,이 속성을 만든 :
Association = class(TCustomAttribute)
strict private
{ Private declarations }
FMasterKeys : TList<string>;
FDetailKeys : TList<string>;
public
{ Public declarations }
constructor Create(const AMasterKeys, ADetailKeys : array of string);
destructor Destroy(); override;
public
{ Public declarations }
property MasterKeys : TList<string> read FMasterKeys;
property DetailKeys : TList<string> read FDetailKeys;
end;
을이 클래스에 사용하려고 :
[Entity('tablename')]
TSuperUser = class(TEntity)
strict private
[Association(['masterkey'], ['detailkey'])]
Fuser : TAssociation<TUser>;
end;
난 [DCC 오류] E2026 상수 표현 예상 오류를 얻었다.
좋아요, 그래서 이력서에 내가 왜 T의 배열을 속성 매개 변수가 아닌 문자열 배열로 사용할 수 있는지 알지 못합니다.
thx 사전에 도움을 받으십시오.
http://stackoverflow.com/questions/25746629/vcl-printers-pas888-w1025-unsupported-language-feature-custom-attribute –
@David thx (참조 용) – kabstergo