master deatil issue

master deatil issue

Postby stefano.busetto » Wed 01 Feb 2017 13:36

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
:)
stefano.busetto
 
Posts: 2
Joined: Wed 01 Feb 2017 13:20

Re: master deatil issue

Postby AlexP » Thu 02 Feb 2017 08:22

Try to disable cache of the context:

Code: Select all
Context.Options.Cache.Enabled := False;
AlexP
Devart Team
 
Posts: 5525
Joined: Tue 10 Aug 2010 11:35

Re: master deatil issue

Postby stefano.busetto » Thu 02 Feb 2017 08:44

I already did
stefano.busetto
 
Posts: 2
Joined: Wed 01 Feb 2017 13:20

Re: master deatil issue

Postby AlexP » Mon 24 Apr 2017 11:29

You should also call the Save method

Code: Select all
context.Attach(d);
context.Save(d);
AlexP
Devart Team
 
Posts: 5525
Joined: Tue 10 Aug 2010 11:35


Return to EntityDAC