Hello,
I have several indices defined in my data structure. Yet, the corresponding DBIndex decoration is missing from all classes exported as Aurelius entities.
Is there a parameter somewhere that governs this behavior ?
Hello,
No, DBIndex attribute is not exported by Data Modeler, yet.
Thank you for your answer. Any idea when it will be included ?
We have it in our huge backlog, but no timeframe set yet. Maybe in a couple of months.
Hello,
Could I get an answer to my question, please ?
I guess you can use the Script tab to implement what you need:
procedure OnClassGenerated(Args: TClassGeneratedArgs);
begin
{ read Args.DBTable.Indexes and write your DBIndex attributes }
end;
That is an excellent idea! Thanks
Indeed, I simply forgot that you could do that from customization script. That was actually the reason to implement the script: to allow users export more attribute and/or customize generated code, without the need to implement every single feature in Data Modeler.
procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
I, J: Integer;
Idx: TGDAOIndex;
Fields: string;
Attr: TCodeAttributeDeclaration;
begin
for I := 0 to Args.DBTable.Indexes.Count - 1 do
begin
Idx := Args.DBTable.Indexes;
Fields := '';
for J := 0 to Idx.IFields.Count - 1 do
begin
if Fields <> '' then Fields := Fields + ',';
Fields := Fields + Idx.IFields[J].FieldName;
end;
Attr := Args.CodeType.AddAttribute('DBIndex');
Attr.AddRawArgument('''' + Idx.IndexName + '''');
Attr.AddRawArgument('''' + Fields + '''');
end;
end;