Fauna v10 .NET/C# Driver 0.2.0-beta
 
Loading...
Searching...
No Matches
BaseDocument.cs
Go to the documentation of this file.
1using System.Collections;
2
3namespace Fauna.Types;
4
8public class BaseDocument : IReadOnlyDictionary<string, object?>
9{
10 private readonly Dictionary<string, object?> _data;
11
15 public DateTime Ts { get; }
16
20 public Module Collection { get; }
21
27 public BaseDocument(Module coll, DateTime ts)
28 {
29 Ts = ts;
30 Collection = coll;
31 _data = new Dictionary<string, object?>();
32 }
33
40 public BaseDocument(Module coll, DateTime ts, Dictionary<string, object?> data)
41 {
42 Ts = ts;
43 Collection = coll;
44 _data = new Dictionary<string, object?>(data);
45 }
46
49 public IEnumerator<KeyValuePair<string, object?>> GetEnumerator()
50 {
51 return _data.GetEnumerator();
52 }
53
56 IEnumerator IEnumerable.GetEnumerator()
57 {
58 return GetEnumerator();
59 }
60
65 public int Count => _data.Count;
66
67
74 public bool ContainsKey(string key)
75 {
76 return _data.ContainsKey(key);
77 }
78
86 public bool TryGetValue(string key, out object? value)
87 {
88 return _data.TryGetValue(key, out value);
89 }
90
96 public object? this[string key] => _data[key];
97
100 public IEnumerable<string> Keys => _data.Keys;
101
104 public IEnumerable<object?> Values => _data.Values;
105}
Represents the base structure of a document.
bool TryGetValue(string key, out object? value)
Gets the value associated with the specified key.
Module Collection
Gets the collection to which the document belongs.
BaseDocument(Module coll, DateTime ts, Dictionary< string, object?> data)
Initializes a new instance of the BaseDocument class with specified collection, timestamp,...
BaseDocument(Module coll, DateTime ts)
Initializes a new instance of the BaseDocument class with specified collection and timestamp.
DateTime Ts
Gets the timestamp of the document.
IEnumerator< KeyValuePair< string, object?> > GetEnumerator()
Returns an enumerator that iterates through the data of the document.
IEnumerable< string > Keys
Gets a collection containing the keys of the data in the document.
IEnumerable< object?> Values
Gets a collection containing the values, excluding properties, of the Document.
int Count
Gets the count of key-value pairs contained in the document.
bool ContainsKey(string key)
Determines whether the Document contains the specified key.
Represents a module, a singleton object grouping related functionalities. Modules are serialized as @...
Definition Module.cs:8