It's really nice, how TCustomAureliusDataset appends Fields of the given Class.
Can you extract the part within the loop in a seperate protected Method, so that we could use this with our own loop? (for example if we have to use GetClassStateMembers)
As a second request, a Callback-Function for setting TFieldDef.DisplayName would be nice.
function (aOptimization: TRttiOptimization): string of object; // Get-Custom-Displayname
aOptimization should be current member, Result will be DisplayName for this field.
Callback-Function could be a Datasetfield or a Parameter, just what you think is best.
AddFieldDefsFromClass should look like this at the end:
procedure TCustomAureliusDataset.AddFieldDefsFromClass(const APrefix: string;
AClass: TClass; ADepth: Integer);
var
O: TRttiOptimization;
begin
for O in Explorer.GetClassVisibleMembers(AClass, True) do
AddFieldDefFromOptimization(aPrefix, aClass, aDepth, O, AddFieldDefsFromClass);
end;
Recursion for TFieldInclusion.Entity would be done by the last parameter.
Well, I could, but it would be faster, if this could appear in a single loop.
Especially, if you think of closing, clearing Manager, reopening the dataset, because you have to load changes from outside.
I just recognized, that you are initializing FieldDefs, for those TFieldDef does not provide a posibility for setting DisplayName at all..
So this second request is useless at all...