Here is a small example that change ALL Id attributes to TIdGenerator.Uuid32. You can write additional logic to choose specific classes to have the id changed.
procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
Attr: TCodeAttributeDeclaration;
I: Integer;
begin
for I := 0 to Args.CodeType.CustomAttributes.Count - 1 do
begin
Attr := Args.CodeType.CustomAttributes;
if Attr.Name = 'Id' then
begin
TCodeSnippetExpression(Attr.Arguments[1].Value).Value :=
'TIdGenerator.Uuid32';
end;
end;
end;
procedure OnClassGenerated(Args: TClassGeneratedArgs); var Attr: TCodeAttributeDeclaration; i: Integer; begin for I := 0 to Args.CodeType.CustomAttributes.Count - 1 do begin Attr := Args.CodeType.CustomAttributes[i]; if Attr.Name = 'Id' then begin TCodeSnippetExpression(Attr.Arguments[1].Value).Value := 'TIdGenerator.Uuid32'; end; end;
end;
It seems that enabeling 'BBcodes to format post' removes the [i] from the original code