IRelationship Interface |
Namespace: PDTec.IceNet.Core.Model
public interface IRelationship
The IRelationship type exposes the following members.
Name | Description | |
---|---|---|
ChangedBy |
The name of the user who changed the relationship last.
| |
ChangedOn |
The point of time the relationship was changed last.
| |
CreatedBy |
The name of the user who created the relationship.
| |
CreatedOn |
The point of time the relationship was created.
| |
Description |
The relationship description. The description can be empty.
| |
Id |
The relationship ID. The ID is generated by the platform and
cannot be modified.
| |
IsValid |
Indicates if the relationship instance is valid. The relationship becomes
invalid if the Destroy method is called or if an associated
object has been destroyed.
| |
ObjectFrom |
Gets the referenced object in From direction.
| |
ObjectTo |
Gets the referenced object in To direction.
| |
RelType |
Gets the relationship type.
|
Name | Description | |
---|---|---|
Destroy |
Deletes the relationship.
| |
GetAttrValue(String) |
Retrieves the specified attribute value.
| |
GetAttrValue(IRelAttrDef) |
Retrieves the specified attribute value.
| |
GetAttrValue(String, Boolean) | Obsolete.
Retrieves the specified attribute value and indicates if the value is assigned.
| |
GetAttrValue(IRelAttrDef, Boolean) | Obsolete.
Retrieves the specified attribute value and indicates if the value is assigned.
| |
GetAttrValues |
Get all attribute values of the relationship.
| |
GetObject |
Retrieves the associated object in the specified direction.
| |
GetRelType |
Retrieve the relationship type.
| |
Reload |
Refreshes the relationship data from secondary storage (e.g. database)
if available. Use this method to retrieve up-to-date audit information
(ChangedBy, ChangedOn properties).
| |
SetAttrValue(String, Object) |
Stores the specified attribute value.
| |
SetAttrValue(IRelAttrDef, Object) |
Stores the specified attribute value.
| |
SetAttrValues |
Set multiple attribute values with a single method call.
| |
Touch |
Updates the ChangedBy and ChangedOn information.
| |
TryGetAttrValue(String, Boolean) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(String, DateTime) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(String, Double) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(String, Int64) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(String, Object) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(String, String) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, Boolean) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, DateTime) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, Double) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, Int64) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, Object) |
Attempts to get the specified attribute value and indicates if the value is assigned.
| |
TryGetAttrValue(IRelAttrDef, String) |
Attempts to get the specified attribute value and indicates if the value is assigned.
|
This example shows how to create relationships.
IObject pBooking = Repository.GetObject(objectId); IObject pVehicle = Repository.GetObject(vehicleId); IRelType pRelType = Repository.GetRelTypeByName("PDTec.ICR.BookedVehicle"); Repository.ExecuteTransaction(delegate() { // Create a relationship between the two objects... IRelationship pRelationship = pRelType.CreateRelationship(pBooking, pVehicle, ""); // ...[do something with the new relationship]... });
This example shows how to navigate relationships.
IObject pCustomer = Repository.GetObject(customerId); IRelationship[] aRelationships = pCustomer.GetRelationships( "PDTec.ICR.CustomerBookings", RelDirection.Forward); foreach (IRelationship pRelationship in aRelationships) { IObject pBooking = pRelationship.ObjectTo; // ...[do something with the booking]... IRelationship pRelationshipVehicle = pBooking.GetSingleRelationship( "PDTec.ICR.BookedVehicle", RelDirection.Forward); IObject pVehicle = pRelationshipVehicle.ObjectTo; // ...[do something with the booked vehicle]... }
This example shows how to use the TryGetSingleRelationship(String, RelDirection, IRelationship) method to avoid an exception when no matching relationship is attached to the object.
IObject pBooking = Repository.GetObject(bookingId); // ...[do something with the booking]... IRelationship pRelationshipVehicle; if (pBooking.TryGetSingleRelationship("PDTec.ICR.BookedVehicle", RelDirection.Forward, out pRelationshipVehicle)) { IObject pVehicle = pRelationshipVehicle.ObjectTo; // ...[do something with the booked vehicle]... }