/// <summary> /// Provides the model element which corresponds to the guid provided /// </summary> /// <param name="guid"></param> /// <returns></returns> public ModelElement GetModel(string guid) { ModelElement retVal = null; if (guid != null) { try { UniqueAccess.WaitOne(); if (!_cache.TryGetValue(guid, out retVal)) { // Update cache's contents GuidVisitor visitor = new GuidVisitor(_cache); foreach (Dictionary dictionary in EfsSystem.Instance.Dictionaries) { visitor.visit(dictionary, true); } // Retrieve the result of the visit if (!_cache.TryGetValue(guid, out retVal)) { // Avoid revisiting when the id does not exist _cache[guid] = null; } } } finally { UniqueAccess.ReleaseMutex(); } } return(retVal); }
/// <summary> /// Provides the model element which corresponds to the guid provided /// </summary> /// <param name="guid"></param> /// <returns></returns> public ModelElement GetModel(string guid) { ModelElement retVal = null; if (guid != null) { UniqueAccess.WaitOne(); if (!_cache.TryGetValue(guid, out retVal)) { // Update cache's contents GuidVisitor visitor = new GuidVisitor(_cache); foreach (Dictionary dictionary in EfsSystem.Instance.Dictionaries) { visitor.visit(dictionary, true); } // Retrieve the result of the visit if (!_cache.TryGetValue(guid, out retVal)) { // Avoid revisiting when the id does not exist _cache[guid] = null; } } UniqueAccess.ReleaseMutex(); } return retVal; }