Implements the reference entity interface, with support for resolving references using lazy loading.
More...
|
| Reference (IReference other) |
| Creates a new reference class that refers to the same object referred to by the other reference class.
|
|
| Reference (string ref_id) |
| Creates a new instance of this reference type that refers to an object with the specified id.
|
|
| Reference (string ref_id, string href) |
| Creates a new reference that refers to an object of the current type, with the specified id but with a specific href (URL) which may be different .
|
|
| Reference (T value) |
| Creates a new reference to the specified resource.
|
|
override bool | Equals (object obj) |
| Determines whether the two reference objects refer to the same object.
|
|
override int | GetHashCode () |
| Serves as a hash function for reference objects.
|
|
T | GetValue (IEnumerable< Parameter > requestParameters=null, int? timeout=null, bool updateCache=false) |
| Gets the resource that this reference refers to. If the reference has not previously been resolved, this is done by requesting it from the server, otherwise the previously resolved instance is returned (unless updateCache is set to true).
|
|
void | Resolve (IEnumerable< Parameter > requestParameters=null, int? timeout=null, bool updateCache=false) |
| Resolve this reference by retrieving the referenced object. If this reference is already resolved, this method does nothing. To refresh the resolved object (e.g. if the referenced object is mutable and might have changed) you can set updateCache to true.
|
|
T | ShallowCopy< T > () |
| Create a shallow copy of this object.
|
|
override string | ToString () |
| Returns this reference's id, or value type if it has no id.
|
|
|
string | CollectionName [get] |
| The name of the collection at which this resource resides.
|
|
string | href [get] |
| The HREF that can be used to retrieve the object being referred to.
|
|
string | ref_id [get] |
| The id of the object being referred to.
|
|
string | reference_type [get] |
| In cases where a model can reference resources belonging to one of a number of collections, this property is used to indicate what type of resource the collection refers to.
|
|
bool | resolved [get] |
| Indicates whether this reference has been resolved into an object.
|
|
Type | ResourceType [get] |
| Returns the runtime type of resource this reference refers to, or the generic type parameter T if unresolved.
|
|
T | Value [get] |
| Returns the object this reference refers to by resolving it with a request to the server.
|
|
Implements the reference entity interface, with support for resolving references using lazy loading.
Definition at line 19 of file Reference[T].cs.
◆ Reference() [1/4]
Creates a new instance of this reference type that refers to an object with the specified id.
- Parameters
-
ref_id | The id of the object being referred to. |
Definition at line 86 of file Reference[T].cs.
◆ Reference() [2/4]
Creates a new reference that refers to an object of the current type, with the specified id but with a specific href (URL) which may be different .
- Parameters
-
ref_id | The id of the object being referred to. |
href | The HREF of the object being referred to. |
Definition at line 92 of file Reference[T].cs.
◆ Reference() [3/4]
Creates a new reference class that refers to the same object referred to by the other reference class.
- Parameters
-
other | The reference class to copy reference information from. |
Definition at line 119 of file Reference[T].cs.
◆ Reference() [4/4]
Creates a new reference to the specified resource.
- Parameters
-
value | The resource to create a reference to. |
Definition at line 139 of file Reference[T].cs.
◆ Equals()
Determines whether the two reference objects refer to the same object.
- Parameters
-
obj | The reference object to compare to this one. |
- Returns
- True if the two reference objects are equivalent.
Definition at line 278 of file Reference[T].cs.
◆ GetHashCode()
Serves as a hash function for reference objects.
- Returns
- A hash code for the current Reference.
Definition at line 293 of file Reference[T].cs.
◆ GetValue()
Gets the resource that this reference refers to. If the reference has not previously been resolved, this is done by requesting it from the server, otherwise the previously resolved instance is returned (unless updateCache is set to true).
- Parameters
-
requestParameters | Optional - Additional parameters to include in the GET request resolving the resource, only used if the resource is not already resolved, or if updateCache is set to true. |
timeout | Optional (Default: no timeout) - The desired request timeout (in milliseconds) after which the request will time out. |
updateCache | Optional (Default: false) - Set to true to ignore the previously resolved reference value (if any) and retrieve an updated copy of the resource from the server. If false, and this reference was previously resolved, a reference to the previously resolved resource will be returned. |
- Exceptions
-
RequestTimeoutException | If the server takes longer than timeout milliseconds to return the resource. |
- Returns
- The resource that this reference refers to.
Definition at line 192 of file Reference[T].cs.
◆ GuessHref()
Attempts to guess the URL at which this resource can be resolved based on the resource collection name specified by the type T.
- Returns
- The guessed URL at which this resource can be resolved.
Definition at line 163 of file Reference[T].cs.
◆ operator Reference< T >()
Allows an IAPIResource object to be explicitly converted to a new Reference to that object via casting.
◆ Resolve()
Resolve this reference by retrieving the referenced object. If this reference is already resolved, this method does nothing. To refresh the resolved object (e.g. if the referenced object is mutable and might have changed) you can set updateCache to true.
- Parameters
-
requestParameters | Optional - Additional parameters to include in the GET request resolving the resource, only used if the resource is not already resolved. |
timeout | Optional (Default: no timeout) - The desired request timeout (in milliseconds) after which the request will time out. |
updateCache | Optional (Default: false) - Set to true to ignore any previously resolved reference value (if any) and re-retrieve an updated copy of the resource from the server. If false, and this reference was previously resolved, a reference to the previously resolved resource will be returned. |
- Exceptions
-
RequestTimeoutException | If the server takes longer than timeout milliseconds to return the resource. |
Definition at line 214 of file Reference[T].cs.
◆ ShallowCopy< T >()
T AnalyzeRe.IAPIType.ShallowCopy< T > |
( |
| ) |
|
|
inherited |
Create a shallow copy of this object.
- Returns
- A shallow copy of this object.
Implemented in AnalyzeRe.APIType.
◆ ToString()
Returns this reference's id, or value type if it has no id.
- Returns
- The content of the ref_id property.
Definition at line 310 of file Reference[T].cs.
◆ CollectionName
The name of the collection at which this resource resides.
Definition at line 40 of file Reference[T].cs.
◆ href
The HREF that can be used to retrieve the object being referred to.
Definition at line 22 of file IReference.cs.
◆ ref_id
The id of the object being referred to.
Definition at line 17 of file IReference.cs.
◆ reference_type
In cases where a model can reference resources belonging to one of a number of collections, this property is used to indicate what type of resource the collection refers to.
Definition at line 13 of file IReference.cs.
◆ resolved
Indicates whether this reference has been resolved into an object.
Definition at line 44 of file Reference[T].cs.
◆ ResourceType
Returns the runtime type of resource this reference refers to, or the generic type parameter T if unresolved.
Definition at line 49 of file Reference[T].cs.
◆ Value
Returns the object this reference refers to by resolving it with a request to the server.
Definition at line 57 of file Reference[T].cs.
The documentation for this class was generated from the following file: