/// <see cref="IFeatureStore.Get{T}(VersionedDataKind{T}, string)"/> public T Get <T>(VersionedDataKind <T> kind, string key) where T : class, IVersionedData { try { RwLock.TryEnterReadLock(RwLockMaxWaitMillis); IDictionary <string, IVersionedData> itemsOfKind; IVersionedData item; if (!Items.TryGetValue(kind, out itemsOfKind)) { Log.DebugFormat("Key {0} not found in '{1}'; returning null", key, kind.GetNamespace()); return(null); } if (!itemsOfKind.TryGetValue(key, out item)) { Log.DebugFormat("Key {0} not found in '{1}'; returning null", key, kind.GetNamespace()); return(null); } if (item.Deleted) { Log.WarnFormat("Attempted to get deleted item with key {0} in '{1}'; returning null.", key, kind.GetNamespace()); return(null); } return((T)item); } finally { RwLock.ExitReadLock(); } }
/// <inheritdoc/> public T Get <T>(VersionedDataKind <T> kind, string key) where T : class, IVersionedData { ImmutableDictionary <string, IVersionedData> itemsOfKind; IVersionedData item; if (!Items.TryGetValue(kind, out itemsOfKind)) { Log.DebugFormat("Key {0} not found in '{1}'; returning null", key, kind.GetNamespace()); return(null); } if (!itemsOfKind.TryGetValue(key, out item)) { Log.DebugFormat("Key {0} not found in '{1}'; returning null", key, kind.GetNamespace()); return(null); } if (item.Deleted) { Log.WarnFormat("Attempted to get deleted item with key {0} in '{1}'; returning null.", key, kind.GetNamespace()); return(null); } return((T)item); }