Welcome Guest! To enable all features please Login or Register.



How update, in session, a cache loader from a dynamic enumeration.
#1 Posted : Saturday, June 27, 2020 11:48:57 PM(UTC)

How update, in session, a cache loader from a dynamic enumeration based on a service, after this enumeration is updated.

A cache loader from a dynamic enumeration based on a service is not updated, in session, when the enumeration is updated. Why?

Please, can you implement that? And, can explain how do it.
#2 Posted : Sunday, June 28, 2020 7:43:09 AM(UTC)

Hi Jeronimo, thanks for reaching out with your questions.

If you have a globally cached dynamic enumeration that is sourced by a cache loader, and need to refresh the cache when the values change, you can just remove that lookup table from the cache, and it will be reloaded automatically whenever the properties try to show a list of values or look up a value in the table. If you also need to refresh the list of values or the current values for any enum properties displayed on the screen, then you can manually have them fire a PropertyChange.Items event, or update their value respectively.

For example, in our demo we had a cached list of sales persons, because you don't update them often. But if you do update a sales person, then you can call a method like the one below.

public async Task ReloadCachedSalesPersons()
    // if you add, update or delete a sales person, you need to remove the cached table
    var cache = LookupCache.Get(ServiceProvider, LookupCache.Global);

    // to reload and cache a new list of sales persons immediately, make the following call
    await cache.GetLookupTableAsync(Enumerations.SalesPerson.EnumName);

    // or you can make the control bound to the SalesPersonIdProperty update
    // its list of items, which will also reload the cache, as follows
    await SalesPersonIdProperty.FirePropertyChangeAsync(
        new PropertyChangeEventArgs(PropertyChange.Items, null, null, null));

Is this what you were looking for?

Please let us know if this works for you, or if you have any other questions.
#3 Posted : Friday, July 17, 2020 1:00:20 AM(UTC)

Thank you.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.