Hey guys,
I have a question regarding the sequence of saving data.
When we call adapter.Save(Entity, true, true) llblgen internally determines the sequence of the actions(inserts, updates).
So my question is regarding the case when I have a schema like this:
Entity: Main
ID int not null,
Name nvarchar(50),
DefaultDetailID int <- nullable
Entity: Detail
ID int not null,
Name nvarchar(50),
MasterID int not null
As you can see it is "improved" version of Master - Detail 1:M relation, when master record has a reference to the detail too.
After doing all the code generation we can write the sample code:
var detaultDetail = new DetailEntity
{
Id = 1,
Caption = "Detail 1"
};
var main = new MainEntity
{
Id = 1,
Caption = "Rec 1",
DetaultDetail = detaultDetail,
};
main.Details.Add(detaultDetail);
adapter.SaveEntity(main, true, true);
There is no problem to re-write the code with two calls(insert + update), so that the data is saved, but I'm just wondering is there any reason why it can not/wasn't added to llblgen?
You have everything in-place when determining the sequence and queries to be executed so why not to handle it automatically ?
Thanks,
Anton