private ListRequestedArgs OnListRequired(IFieldPath path) { var args = new ListRequestedArgs(path); if (ListRequested != null) { ListRequested(this, args); } return(args); }
/// <summary> /// Sets e.List to cached data, or triggers fetch if not previously cached. /// </summary> /// <param name="e"></param> public virtual void UpdateCache(ListRequestedArgs e) { // deals with the case where the list was set manually or some other event handler dealt with it, // or if we don't have the required instances to fulfill the request if (e.List != null || e.Path.Last.List == null || DbService == null) // || Configuration == null || Connection == null || ResultFactory == null) { return; } // initialise the type of list, pending data below e.Type = e.Path.Last.List.Type; // if we've cached this path before, use it if (_listCache.ContainsKey(e.Path)) { e.List = _listCache[e.Path].Data; return; } UpdateCache(e.Path); e.List = _listCache[e.Path].Data; }
private void ControlFactory_ListRequested(object sender, ListRequestedArgs e) { Cacher.UpdateCache(e); }