Esempio n. 1
0
        // 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);
        }
Esempio n. 2
0
 // 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;
     });
 }
Esempio n. 3
0
 // 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;
     }));
 }
Esempio n. 4
0
        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();
                }
            }
        }
Esempio n. 5
0
 // 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);
 }
Esempio n. 6
0
 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();
         }
     }
 }