Fauna v10 .NET/C# Driver 0.3.0-beta
 
Loading...
Searching...
No Matches
BaseRef.cs
Go to the documentation of this file.
1using Fauna.Linq;
2
3namespace Fauna.Types;
4
5public abstract class BaseRef<T>
6{
7
12 protected readonly T? Doc;
13
17 public string? Cause { get; }
18
22 public Module Collection { get; }
23
27 public bool? Exists { get; }
28
32 public bool IsLoaded { get; } = false;
33
35 {
36 Collection = new Module(col.Name);
37 }
38
39
40 public BaseRef(DataContext.ICollection col, T doc)
41 {
42 Collection = new Module(col.Name);
43 Doc = doc;
44 IsLoaded = true;
45 Exists = true;
46 }
47
48 public BaseRef(DataContext.ICollection col, string cause)
49 {
50 Collection = new Module(col.Name);
51 Exists = false;
52 Cause = cause;
53 IsLoaded = true;
54 }
55
56 public BaseRef(Module coll)
57 {
58 Collection = coll;
59 }
60
61 public BaseRef(Module coll, T doc)
62 {
63 Collection = coll;
64 Exists = true;
65 Doc = doc;
66 IsLoaded = true;
67 }
68
69 public BaseRef(Module coll, string cause)
70 {
71 Collection = coll;
72 Exists = false;
73 Cause = cause;
74 IsLoaded = true;
75 }
76
77 public abstract T Get();
78}
79
80internal class UnloadedRefException : Exception
81{
82}
Fauna.Types.Module Module
Definition MappingInfo.cs:4
readonly? T Doc
Gets the materialized document represented by the Ref. Is null unless IsLoaded is true and Exists is ...
Definition BaseRef.cs:12
BaseRef(DataContext.ICollection col, string cause)
Definition BaseRef.cs:48
BaseRef(Module coll, T doc)
Definition BaseRef.cs:61
BaseRef(DataContext.ICollection col, T doc)
Definition BaseRef.cs:40
string? Cause
Gets the cause when exists is false. Is null unless IsLoaded is true and Exists is false.
Definition BaseRef.cs:17
BaseRef(Module coll, string cause)
Definition BaseRef.cs:69
bool IsLoaded
Gets a boolean indicating whether the document represented by the ref has been loaded.
Definition BaseRef.cs:32
BaseRef(DataContext.ICollection col)
Definition BaseRef.cs:34
Module Collection
Gets the collection to which the ref belongs.
Definition BaseRef.cs:22
bool? Exists
Gets a boolean indicating whether the doc exists. Is null unless IsLoaded is true.
Definition BaseRef.cs:27
BaseRef(Module coll)
Definition BaseRef.cs:56
Represents a module, a singleton object grouping related functionalities. Modules are serialized as @...
Definition Module.cs:8