// Forces a Refresh for a particular handle, not checking the RowVersion public void Refresh(HandleInfo handleInfo) { _objects.Remove(handleInfo.Handle); var target = _dataService.ProcessRequest(handleInfo.ObjectType, handleInfo.Parameters); handleInfo.Update(target); _objects.Add(handleInfo.Handle, handleInfo); }
// Tries to get an existing handle for the given object type and parameters. // If there is no existing handle, creates a new handle with the target provided by evaluating the delegate 'func' // (with the given object type and parameters). public object GetHandle(string objectType, object[] parameters, Func<string, object[], IHasRowVersion> func) { return ExcelAsyncUtil.Observe(objectType, parameters, () => { var target = _dataService.ProcessRequest(objectType, parameters); var handleInfo = new HandleInfo(this, objectType, parameters, target); _objects.Add(handleInfo.Handle, handleInfo); return handleInfo; }); }
// Tries to get an existing handle for the given object type and parameters. // If there is no existing handle, creates a new handle with the target provided by evaluating the delegate 'func' // (with the given object type and parameters). public object GetHandle(string objectType, object[] parameters, Func <string, object[], IHasRowVersion> func) { return(ExcelAsyncUtil.Observe(objectType, parameters, () => { var target = _dataService.ProcessRequest(objectType, parameters); var handleInfo = new HandleInfo(this, objectType, parameters, target); _objects.Add(handleInfo.Handle, handleInfo); return handleInfo; })); }
internal void Remove(HandleInfo handleInfo) { object value; if (TryGetObject(handleInfo.Handle, out value)) { _objects.Remove(handleInfo.Handle); var disp = value as IDisposable; if (disp != null) { disp.Dispose(); } } }