All requested functionality is provided by FireDAC
's component named TFDSchemaAdapter
.
This component handles all id assignments.
Delphi documentantion: https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Comp.Client.TFDSchemaAdapter
Examples: https://docwiki.embarcadero.com/CodeExamples/Athens/en/FireDAC.SchemaAdapterMemTable_Sample
Or examples on GitHub: https://github.com/Embarcadero/RADStudio12Demos/tree/main/Object%20Pascal/Database/FireDAC/Samples/Comp%20Layer/TFDQuery/CachedUpdates/Centralized
Very simple snippet showing data saving do db, once everything is set according manual above:
if FDSchemaAdapter1.UpdatesPending then
begin
FDSchemaAdapter1.ApplyUpdates; //applies correct IDs to all binded queries
FDQuery1.CommitUpdates;
FDQuery2.CommitUpdates;
FDQuery3.CommitUpdates;
end;