I started learning AX today, and I saw an example:
[ DataContractAttribute, SysOperationContractProcessingAttribute( classStr(HW_Apgiam_UI), SysOperationDataContractProcessingMode:: CreateUIBuilderForRootContractOnly) ] class HW_Apgiam_CT implements SysOperationInitializable { Str1260 companycode; // StartDate fromDate; EndDate toDate; Str1260 mainAccountId; Str1260 vendAccount; CurrencyCode currency; }
and
[ DataMemberAttribute("CompanyCode"), SysOperationLabelAttribute(literalstr("Company Code :")) ] public Str1260 parmCompany(Str1260 _companycode = companycode) { companycode = _companycode; return companycode; }
Can anyone tell me the code inside "[]" can do, I can not find out the answer on the internet.
Thanks.
*This post is locked for comments
I have the same question (0)The things inside [ ] are "attributes".
They're used to add additional information to classes and methods. In your example, attributes say that the class is a data contract (AX knows how to serialize data contract classes), that there is another class (HW_Apgiam_UI) that should be used for generating a dialog for this contract, which label should be used in the dialog for Company and so on.
By the way, the value of SysOperationLabelAttribute is wrong. It should be a label ID, so there may be translations to other languages. It also shouldn't suffixed with " :".