C# Client Library
A C# Client Library for the AnalyzeRe REST API
|
Implements the basic reference entity interface, but has no support for resolving references. More...
Public Member Functions | |
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 by requesting it from the server. | |
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. | |
virtual T | ShallowCopy< T > () |
Create a shallow copy of this object.
for a serializer-based copy method. | |
override string | ToString () |
Returns this reference's id. | |
Protected Member Functions | |
Reference (string ref_id, string href) | |
Creates a new reference class that refers to an object with the specified id, type, and HREF. Normally called only by the serializer when a response containing a reference is received by the server. | |
virtual void | AfterMembersCloned (APIType originalResource) |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned. | |
Properties | |
string | CollectionName [get] |
The name of the collection at which this resource resides. | |
string | href [get, protected set] |
The HREF that can be used to retrieve the object being referred to. | |
string | ref_id [get, protected set] |
The id of the object being referred to. | |
string | reference_type [get, protected set] |
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 the reference has been resolved and the value is available. | |
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 resolved object being referred to. | |
Implements the basic reference entity interface, but has no support for resolving references.
Definition at line 14 of file Reference.cs.
Creates a new reference class that refers to an object with the specified id, type, and HREF. Normally called only by the serializer when a response containing a reference is received by the server.
ref_id | The id of the object being referred to. |
href | The HREF of the object being referred to. |
Definition at line 46 of file Reference.cs.
|
inlineprotectedvirtualinherited |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
Overriding implementations should be sure to invoke base.AfterMembersCloned().
A sane question for a code reviewer to ask might be: "Why not avoid copying those members in the first place?" The answer is that there is no framework-supported method of excluding members from a MemberwiseClone. The only officially supported solution is to not use the object.MemberwiseClone method at all and instead have each class implement it's own Copy method. In our case, most objects have no need to specialize their copy implementation (even though they could - the ShallowCopy<T> method is marked virtual). It's simpler to simply "correct" any special-case members after the fact, and requires less error-prone code than if the code were responsible for ensuring no members were missed in a copy. It's also faster than any reflection-based approach, even though such an approach could benefit from custom attributes meant to exclude certain members from copying.
Reimplemented in AnalyzeRe.APITypes.APIResource_WithDataEndpoint, AnalyzeRe.APIResourceView.BaseAPIResourceView, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, AnalyzeRe.Optimization.Candidate, AnalyzeRe.Optimization.OptimizationView, and AnalyzeRe.StaticSimulation.
Definition at line 37 of file APIType.cs.
Determines whether the two reference objects refer to the same object.
obj | The reference object to compare to this one. |
Definition at line 57 of file Reference.cs.
Serves as a hash function for reference objects.
Definition at line 66 of file Reference.cs.
|
inherited |
Gets the resource that this reference refers to by requesting it from the server.
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. |
RequestTimeoutException | If the server takes longer than timeout milliseconds to return the resource. |
|
inherited |
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.
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. |
RequestTimeoutException | If the server takes longer than timeout milliseconds to return the resource. |
Create a shallow copy of this object.
for a serializer-based copy method.
If this object contains any members that reference the current object (this), the class should override this method to avoid cloning a reference to the old class.
Implements AnalyzeRe.IAPIType.
T | : | IAPIType |
Definition at line 14 of file APIType.cs.
Returns this reference's id.
Definition at line 75 of file Reference.cs.
|
getinherited |
The name of the collection at which this resource resides.
Definition at line 27 of file IReference[T].cs.
|
getprotected set |
The HREF that can be used to retrieve the object being referred to.
Implements AnalyzeRe.IReference< out T >.
Definition at line 37 of file Reference.cs.
|
getprotected set |
The id of the object being referred to.
Implements AnalyzeRe.IReference< out T >.
Definition at line 32 of file Reference.cs.
|
getprotected set |
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.
This property is currently only used behind-the-scenes for serialization and deserialization of reference types. The supported way of specifying the reference type in this library is to instantiate a Reference<T> with the appropriate generic type argument.
Implements AnalyzeRe.IReference< out T >.
Definition at line 28 of file Reference.cs.
|
getinherited |
Indicates whether the reference has been resolved and the value is available.
Definition at line 16 of file IReference[T].cs.
|
getinherited |
Returns the runtime type of resource this reference refers to, or the generic type parameter T if unresolved.
Definition at line 32 of file IReference[T].cs.
|
getinherited |
Returns the resolved object being referred to.
Definition at line 23 of file IReference[T].cs.