Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
BaseRef.cs
Go to the documentation of this file.
1using Fauna.Linq;
2
3namespace Fauna.Types;
4
9public abstract class BaseRef<T>
10{
11
16 protected readonly T? Doc;
17
21 public string? Cause { get; }
22
26 public Module Collection { get; }
27
31 public bool? Exists { get; }
32
36 public bool IsLoaded { get; }
37
38 internal BaseRef(DataContext.ICollection col)
39 {
40 Collection = new Module(col.Name);
41 }
42
43
44 internal BaseRef(DataContext.ICollection col, T doc)
45 {
46 Collection = new Module(col.Name);
47 Doc = doc;
48 IsLoaded = true;
49 Exists = true;
50 }
51
52 internal BaseRef(DataContext.ICollection col, string cause)
53 {
54 Collection = new Module(col.Name);
55 Exists = false;
56 Cause = cause;
57 IsLoaded = true;
58 }
59
60 internal BaseRef(Module coll)
61 {
62 Collection = coll;
63 }
64
65 internal BaseRef(Module coll, T doc)
66 {
67 Collection = coll;
68 Exists = true;
69 Doc = doc;
70 IsLoaded = true;
71 }
72
73 internal BaseRef(Module coll, string cause)
74 {
75 Collection = coll;
76 Exists = false;
77 Cause = cause;
78 IsLoaded = true;
79 }
80
85 public abstract T Get();
86}
87
88internal class UnloadedRefException : Exception
89{
90}
Fauna.Types.Module Module
Definition MappingInfo.cs:4
An abstract class representing a DataContext. This is a special type of Fauna client that can be used...
An abstract class representing a reference that can wrap an instance of the referenced document.
Definition BaseRef.cs:10
readonly? T Doc
Gets the materialized document represented by the Ref. Is null unless IsLoaded is true and Exists is ...
Definition BaseRef.cs:16
string? Cause
Gets the cause when exists is false. Is null unless IsLoaded is true and Exists is false.
Definition BaseRef.cs:21
bool IsLoaded
Gets a boolean indicating whether the document represented by the ref has been loaded.
Definition BaseRef.cs:36
T Get()
Gets the underlying document if it's loaded and exists.
Module Collection
Gets the collection to which the ref belongs.
Definition BaseRef.cs:26
bool? Exists
Gets a boolean indicating whether the doc exists. Is null unless IsLoaded is true.
Definition BaseRef.cs:31
Represents a module, a singleton object grouping related functionalities. Modules are serialized as @...
Definition Module.cs:8
An interface for a Fauna collection within a DataContext.