示例#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);
        }
示例#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;
     });
 }
示例#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;
     }));
 }
示例#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();
                }
            }
        }
示例#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);
 }
示例#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();
         }
     }
 }