/// <inheritdoc /> public IEnumerator <KeyValuePair <string, object> > GetRawEnumerator() { HashSet <string> keys = new HashSet <string>(StringComparer.OrdinalIgnoreCase); if (Metadata != null) { foreach (KeyValuePair <string, object> item in Metadata.GetRawEnumerable()) { if (keys.Add(item.Key)) { yield return(item); } } } foreach (KeyValuePair <string, object> item in PropertyMetadata <TDocument> .For((TDocument)this).GetRawEnumerable()) { if (keys.Add(item.Key)) { yield return(item); } } if (BaseMetadata != null) { foreach (KeyValuePair <string, object> item in BaseMetadata.GetRawEnumerable()) { if (keys.Add(item.Key)) { yield return(item); } } } }
/// <inheritdoc /> public bool TryGetRaw(string key, out object value) { value = default; return((!IDocument.Properties.Contains(key) && Metadata?.TryGetRaw(key, out value) == true) || PropertyMetadata <TDocument> .For((TDocument)this).TryGetRaw(key, out value) || (BaseMetadata?.TryGetRaw(key, out value) ?? false)); }
/// <inheritdoc /> public bool TryGetRaw(string key, out object value) { value = default; return((Metadata?.TryGetRaw(key, out value) ?? false) || PropertyMetadata <TDocument> .For((TDocument)this).TryGetRaw(key, out value) || (BaseMetadata?.TryGetRaw(key, out value) ?? false)); }
public IEnumerator <KeyValuePair <string, object> > GetEnumerator() { HashSet <string> keys = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, object> item in _metadata.Concat(PropertyMetadata <T> .For(Object))) { if (keys.Add(item.Key)) { yield return(item); } } }
/// <inheritdoc /> public IEnumerator <KeyValuePair <string, object> > GetRawEnumerator() { HashSet <string> keys = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, object> item in _metadata.GetRawEnumerable().Where(x => !IDocument.Properties.Contains(x.Key))) { if (keys.Add(item.Key)) { yield return(item); } } foreach (KeyValuePair <string, object> item in PropertyMetadata <T> .For(Object).GetRawEnumerable()) { if (keys.Add(item.Key)) { yield return(item); } } }
// IMetadata /// <inheritdoc /> public bool ContainsKey(string key) => (Metadata?.ContainsKey(key) ?? false) || PropertyMetadata <TDocument> .For((TDocument)this).ContainsKey(key) || (BaseMetadata?.ContainsKey(key) ?? false);
public bool TryGetValue <TValue>(string key, out TValue value) => _metadata.TryGetValue(key, out value) || PropertyMetadata <T> .For(Object).TryGetValue(key, out value);
public bool TryGetRaw(string key, out object value) => _metadata.TryGetRaw(key, out value) || PropertyMetadata <T> .For(Object).TryGetRaw(key, out value);
// IMetadata public bool ContainsKey(string key) => _metadata.ContainsKey(key) || PropertyMetadata <T> .For(Object).ContainsKey(key);
// IMetadata /// <inheritdoc /> public bool ContainsKey(string key) => (!IDocument.Properties.Contains(key) && Metadata?.ContainsKey(key) == true) || PropertyMetadata <TDocument> .For((TDocument)this).ContainsKey(key) || (BaseMetadata?.ContainsKey(key) ?? false);
/// <inheritdoc /> public bool TryGetRaw(string key, out object value) => (!IDocument.Properties.Contains(key) && _metadata.TryGetRaw(key, out value)) || PropertyMetadata <T> .For(Object).TryGetRaw(key, out value);
// IMetadata /// <inheritdoc /> public bool ContainsKey(string key) => (!IDocument.Properties.Contains(key) && _metadata.ContainsKey(key)) || PropertyMetadata <T> .For(Object).ContainsKey(key);