Exemple #1
0
 public IProfilingType this[Guid uid]
 {
     get
     {
         lock (_collection)
         {
             VerifyDisposed();
             ProfilingType profilingType;
             if (_collection.TryGetValue(uid, out profilingType))
             {
                 return(profilingType);
             }
             IProfilingType remoteProfilingType = Execute(() => RemoteObject[uid]);
             profilingType = new ProfilingType(remoteProfilingType);
             _collection.Add(uid, profilingType);
             return(profilingType);
         }
     }
 }
Exemple #2
0
 public bool TryGet(Guid uid, out IProfilingType item)
 {
     lock (_collection)
     {
         ProfilingType profilingType;
         if (_collection.TryGetValue(uid, out profilingType))
         {
             item = profilingType;
             return(true);
         }
         IProfilingType remoteProfilingType = null;
         if (Execute(() => RemoteObject.TryGet(uid, out remoteProfilingType)))
         {
             profilingType = new ProfilingType(remoteProfilingType);
             _collection.Add(uid, profilingType);
             item = profilingType;
             return(true);
         }
     }
     item = null;
     return(false);
 }
Exemple #3
0
        private void Initialize()
        {
            if (_initialized)
            {
                return;
            }
            List <IProfilingType> remoteProfilingTypes = Execute(() => RemoteObject.ToList());

            if (remoteProfilingTypes.Count == _collection.Count)
            {
                return;
            }
            foreach (IProfilingType remoteProfilingType in remoteProfilingTypes)
            {
                ProfilingType profilingType = new ProfilingType(remoteProfilingType);
                if (!_collection.ContainsKey(profilingType.Definition.Uid))
                {
                    _collection.Add(profilingType.Definition.Uid, profilingType);
                }
            }
            _initialized = true;
        }