Page 1 of 1

master deatil issue

Posted: Wed 01 Feb 2017 13:36
by stefano.busetto
Hi
I've a master detail model.
I get a master entity with this code:

Code: Select all

m := context.GetEntity<TMaster>([7]);
the detail items do load without problems.

Then i create and add a new detail item to the master

Code: Select all

d := context.CreateEntity<TDetail>;
d.pk := m.pk;
...
context.Attach(d);
m.DetailList.Add(d);
Then i save everything to the database.
The data are saved without problems.
I've checked the content of the d.b. tables.

To finish with i try to get the master entity with the following code

Code: Select all

m1 := context.GetEntity<TMaster>([7]);
but the master detail list does not contain the newly added item.

I close and then start the app again i find the item.

TIA
:)

Re: master deatil issue

Posted: Thu 02 Feb 2017 08:22
by AlexP
Try to disable cache of the context:

Code: Select all

Context.Options.Cache.Enabled := False;

Re: master deatil issue

Posted: Thu 02 Feb 2017 08:44
by stefano.busetto
I already did

Re: master deatil issue

Posted: Mon 24 Apr 2017 11:29
by AlexP
You should also call the Save method

Code: Select all

context.Attach(d);
context.Save(d);