I have an Entity with a lazy loaded association. The underlying data in the database gets updated.
According to the docs:
"Note that when refreshing an object that has lazy-loaded associations, the proxy is
updated and not immediately loaded. When the associated object (or list) is then
read, Aurelius will try to load the objects and if they are in the cache, they
will not be updated. This means if you have lazy-loaded association, specially
lists, and you want the list objects to be refreshed themselves, you should
iterate through the list and call Refresh for each item manually."
Does this mean, I have to issue a TFind<T>.Refreshing and then looping thru all records and for each assocication calling Refresh?
If you are working with lists, yes. The list itself will be refresh (i.e., which objects belong to the list) but the properties of the objects in the list themselves won't. To refresh the properties of the item in the list, you should call Refresh for the list item.
This will retrieve actual data from the DB, i.e., all properties of Invoice objects will be updated.
If each Invoice objet has an Items: TList<TInvoiceItem> property, for example, the list will be updated with the correct TInvoiceItem objects (i.e. if some were removed or inserted, the list will be updated).
However, the *properties* of each TInvoiceItem object in the list won't be refreshed if:
1. The list is a proxy
2. The TInvoiceItem object of the list is already loaded in the manager.
This is my problem. I want to refresh a master/detail. I see, that inserted rows of the detail appear, but changed properties of the detail are not refreshed. Using a TQuery I would issue a close/open. No I am closing/reopening my program. I am sure, I am missing something basic.
You definitely don't need to close/open your application. If you are doing it, it's a sign that you are using a global TObjectManager, which you shouldn't do.
If you don't need to keep the same object instances, you can simply close the dataset, clear the manager (Manager.Clear), redo the query and reopen the dataset.