EntityDAC Professional edition includes the most complete set of components that allows to solve the considered task in even more simple way.
Open the main form in the form designer and delete MasterDataSet and DetailDataSet. Instead, put two TEntityTable components on the form, naming them MasterTable and DetailTable correspondingly.
Link MasterDataSource to MasterTable and DetailDataSource to DetailTable. Then set the MasterTable.TypeName to Dept and DetailTable.TypeName to Emp. Also, set up the master-detail relationship between MasterTable and DetailTable.
Modify the Button1.OnClick event handler. Remove all inner code except opening datasets.
procedure TDemoMainForm.Button1Click(Sender: TObject); begin DetailTable.Open; MasterTable.Open; end;
Compile and run the project, and press the “Open" button.